Hi all,
I am new with digitalocean, I have loaded all my files to the server unfortunately not working like on own pc. The issues I have are do not reload the static files (CSS, media, Js). I have read all comments some how can’t find the error I had only one but not sure about.
Mapping Project:
rootproject
|
├── bichonproject
├── main
│ └── templates
│ └── main
├── static
│ ├── bootstrap
│ │ ├── css
│ │ ├── fonts
│ │ └── js
│ ├── css
│ ├── images
│ ├── js
│ └── media
└── templates
/etc/init/gunicorn.conf
exec gunicorn \
--name=bichonproject \
--pythonpath=rootproject \
--bind=0.0.0.0:9000 \
--config /etc/gunicorn.d/gunicorn.py \
bichon_project.wsgi:application
/etc/nginx/sites-enabled/django
# Your Django project's media files - amend as required
location /media {
alias /home/django/rootproject/bichonproject/static/media;
}
# your Django project's static files - amend as required
location /static {
alias /home/django/root_project/bichon_project/static;
}
setting.py
STATICURL = '/static/'
STATICFILESDIRS = (os.path.join(BASEDIR, "static"),)
TEMPLATEDIRS = (os.path.join(BASE_DIR, "templates"),)
CRISPYTEMPLATEPACK = 'bootstrap3'
Another issue it only work when I run:
sudo python manage.py runserver localhost:9000 after killing server display 502 Bad Gateway nginx/1.4.6(Ubuntu).
using Ubuntu Django on 14.04 and the IPAddress 178.62.73.238
Last question do I need to create newvenv files before create app? virtualenv newvenv, if yes do I need to add to my root_project?
Note: setting.py file under bichon_project and main is home app.
Any help very appreciate.
Thanks
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
Nice one
What i have to do is to move static folder to some of /var/www/static_folder because nginx(or user who is connecting from internet) doesnt have rights to access static files in root.