Log in

Using Spirit with uwsgi

  • 3 May

Hello,

After getting through all of the initial setup, I am now running into a pesky error when using Spirit with uswgi, I am following this guide:

http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html#test-your-django-project

When I try to deploy the example project, using the wsgi.py supplied, I get the error

"ImportError: No module named project.settings.dev_local"

Has anyone ran into this? How did you solve it? I realize this may be a very noobish Django/uwsgi question, but I was just wondering if anyone has had this happen and got over it.

Thanks,

nitelyEsteban Castro Borsani
  • 3 May

Are you able to run $ uwsgi --http :8000 --module mysite.wsgi ?

"ImportError: No module named project.settings.dev_local"

That means there's no ./project/settings/dev_local.py file. Or at least not within the dir you are currently running the command from. If that's the case, you can just create it and add something like this in it:

from .dev import *

and that should work. Or edit the ./mysite/wsgi.py file and add this line.

  • 5 May

I had actually tried that, the trick was for whatever reason it would fail when testing with the command line, versus starting the server via a daemon/script. Was mixing and matching from too many different guides and got confused.

After adding the line 'os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings.dev_local")' to the wsgi.py, the app is up and running with Gunicorn and Nginx now. Thank you so much!

Reply