Im trying to setup my uwsgi and faced with a problem. When I set path to my project in my project folder, UWSGI saw my wsgi.py
but doesn't saw any other apps, cause they are on one level up... But if I try to set path just to my project folder, UWSGI doesn't saw my wsgi.py
... How can I set my path correctly?
You can see my project hierarchy and UWSGI settings, where it saw my wsgi.py
, but not my apps (No module named menuItem
as example), below.
Hierarchy:
root
--reddish
---env
---reddish
----article
----menuItem
----myProject
-----wsgi.py
-----settings.py
UWSGI settings:
[uwsgi]
virtualenv=/root/reddish/env/
chdir=/root/reddish/reddish/myProject/
module=wsgi:application
env=DJANGO_SETTINGS_MODULE=settings
master=True
plugins=python27
vacuum=True
socket=/tmp/%n.sock
pidfile=/tmp/%n.pid
daemonize=/var/log/uwsgi/%n.log
Always avoid running your uWSGI instances as root. You can drop privileges using the uid and gid options:
http://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html#security-and-availability
That ideally means you should move the app out of the root folder as well. But for the moment, you need to fix your path
virtualenv=/root/reddish/env/
chdir=/root/reddish/reddish/
Another point is not to setup your virtualenv as part of your project files. They should ideally be kept separately.
Both these paths should ideally be outside the /root/ folder.
update: The fact that you might need to use different virtualenvs for each project doesn't really matter. In fact there are situations where you might need two virtualenvs for the same project! Consider this: Suppose you are working on django 1.9 at the moment. Django 1.10 is around the corner and may want to upgrade. Then you create a new virtualenv for django 1.10 if you put it inside your project now you have another 30-40 MB of code there that doesn't belong to you. That makes version control and backups difficult.
Virtualenvs are not really part of your project but it's the python installation and third party libraries that your project depend on.
you need to change to redish
and from there point to your settings.
chdir=/root/reddish/reddish
env=DJANGO_SETTINGS_MODULE=myProject.settings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With