I am trying to upload my django project live and I am continuously getting this error:
pkg_resources.ExtractionError: Can't extract file(s) to egg cache
The following error occurred while trying to extract file(s) to the Python egg
cache:
[Errno 13] Permission denied: '/opt/bitnami/.tmp/simplejson-2.0.9-py2.7-linux-x86_64.egg-tmp/simplejson/tmpuYcIYB.$extract'
The Python egg cache directory is currently set to:
/opt/bitnami/.tmp
Perhaps your account does not have write access to this directory? You can
change the cache directory by setting the PYTHON_EGG_CACHE environment
variable to point to an accessible directory.
It is a permissions / ownership problem. You can solve it using these commands:
sudo su bitnami
sudo find /opt/bitnami/apps/django/ -type d -exec chmod 755 {} \;
sudo find /opt/bitnami/apps/django/ -type f -exec chmod 644 {} \;
sudo chown -R bitnami:daemon /opt/bitnami/apps/django/
You must also deploy your projects to the following path: /opt/bitnami/apps/django/django_projects/YOURPROJECT
Related
Is it safe to delete all .pyc files from the Django root directory? I ran the command below in my Django root directory:
find . -name "*.pyc" -exec git rm -f "{}" \;
to delete .pyc files that I saw in my git check-in but the process went for quite some time and deleted hundred of .pyc files within every directory. I am a beginner in Python, Git and I am a bit concerned if this will have an impact on my Django code?
chd.sh
#! /bin/bash
cd django/hellodjango
exec bash
python manage.py runserver
chd.py
# a=`python chd.py`;cd $a
import os
new_dir = "django/hellodjango"
os.chdir(new_dir)
are the two ways I have tried.
Also, on terminal I have tried,
. chd.sh
./chd.sh
. ./chd.sh
I have also tried to assign to variable and then run on terminal but no success.
Spent over 4 hours trying multiple methods given on stackoverflow.com but no success yet.
The only thing that has worked yet is,
alias mycd='cd django/hellodjango'
But I will have to copy paste it everytime.
alias myrun = `cd django/hellodjango && python manage.py runserver`
And,
alias myrun = `cd django/hellodjango; python manage.py runserver`
doesn't work.
This is just a sample, there are so many django commands that I have to use repeatedly. Appreciate if you have read all this way.
If you know the link where this is discussed, please attach the link, as I was not able to find after hours of search.
Edit:
/storage/emulated/0 $
This is what the prompt appears like.
/storage/emulated/0/django/hellodjango
This is the path.
/storage/emulated/0 $ cd django/hellodjango
/storage/emulated/0/django/hellodjango $ python manage.py
runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
July 25, 2020 - 19:08:42
Django version 3.0.7, using settings 'hellodjango.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Individually works fine.
Edit:
/storage/emulated/0 $ chmod u+x chd.sh /storage/emulated/0 $ chmod u+x
rn.sh /storage/emulated/0 $ ./chd.sh ./chd.sh: cd: line 2: can't cd t:
No such file or directory /storage/emulated/0 $ chmod u+x chd.py
/storage/emulated/0 $ a=python chd.py;cd $a
~/data/ru.iiec.pydroid3/app_HOME $
Edit:
/data/user/0/tech.ula/files/support/dbclient: Caution, skipping
hostkey check for localhost
subham#localhost's password:
subham#localhost:~$ ls
subham#localhost:~$ cd
subham#localhost:~$ pwd
/home/subham
subham#localhost:~$ pkg install miniconda
-bash: pkg: command not found
subham#localhost:~$ apt install miniconda
Reading package lists... Done Building dependency tree
Reading state information... Done
E: Unable to locate package miniconda
subham#localhost:~$
subham#localhost:~$ cd ..
subham#localhost:/home$ cd ..
subham#localhost:/$ ls
bin dev host-rootfs mnt root srv
sys var boot etc lib opt run storage tmp data home
media proc sbin support usr
subham#localhost:/$ cd ..
subham#localhost:/$ cd sys
subham#localhost:/sys$ ls
ls: cannot open
directory '.': Permission denied
subham#localhost:/sys$ cd..
-bash: cd..: command not found
subham#localhost:/sys$ cd ..
subham#localhost:/$ cd storage
subham#localhost:/storage$ ls internal
subham#localhost:/storage$ cd internal
subham#localhost:/storage/internal$ ls
subham#localhost:/storage/internal$ ls -l total 0
subham#localhost:/storage/internal$ cd 0
-bash: cd: 0: No such file or directory subham#localhost:/storage/internal$
subham#localhost:/$ chmod -R 777 /host-rootfs
chmod: changing permissions of '/host-rootfs': Read-only file system
chmod: cannot read directory '/host-rootfs': Permission denied
subham#localhost:/$
https://github.com/CypherpunkArmory/UserLAnd/issues/46
When i am creating a file in django and trying to save it too the file App1it gives me an error… Access denied acccessing this file or folder
This link shows how my files look.
Check the ownership of the Django files and make sure that the user you are running the application as has permissions to the files. If you created it under a different user than you are running it under you will not have permissions to modify.
try running this command
sudo chown -R ec2-user:ec2-user App1/
or
sudo chown -R ec2-user:ec2-user mywebsite/
I've tried rm -rf venvpc and I get the error message:
rm: cannot unlink `venvpc/Scripts/python.exe': Permission denied
rm: cannot remove directory `venvpc/Scripts': Directory not empty
rm: cannot remove directory `venvpc': Directory not empty
I removed the virtualenv name 'venvpc' from PyCharm in case there was a link there.
I tried removing via Windows Explorer and it says the folder or a file in it is open in another program.
What can I try next?
You need to do it as root user , so use sudo (on linux) :
sudo rm -rf venvpc
and if you are in windows run runas /noprofile /user:Administrator cmd to command as admin.
I want to use Fabric to chown all the files in a directory - including hidden files. Since Fabric uses the sh shell and not bash and sh doesn't know shopt, I can't do:
local('shopt -s dotglob')
local('sudo chown -R name dir')
I don't think there is a way to use the bash shell in Fabric. Is there another way to do this?
How about using another strategy to recursively chown everything in the directory, including hidden files and directories:
local('sudo find dir -exec chown name {} \;')
Hope that helps.