uwsgi, nginx, and Django/Wagtail
I've been following this tutorial on setting up Django with uwsgi and nginx on a Debian system. (I'm also integrating Django-based CMS Wagtail). My Linode server at 188.8.131.52 runs Debian 9. But when I navigate my browser to the IP address, I get a page that says "Internal server error."
/var/log/nginx/error.log file is blank.
Here's the output of
uwsgi --http :8080 --home /home/myusername/Env/my_site --chdir /home/myusername/my_site -w my_site.wsgi:
*** Starting uWSGI 184.108.40.206 (64bit) on [Mon Jul 30 14:41:53 2018] *** compiled with version: 6.3.0 20170516 on 29 July 2018 21:47:39 os: Linux-4.9.0-7-amd64 #1 SMP Debian 4.9.110-1 (2018-07-05) nodename: sandbox machine: x86_64 clock source: unix detected number of CPU cores: 1 current working directory: /home/myusername detected binary path: /usr/local/bin/uwsgi !!! no internal routing support, rebuild with pcre support !!! chdir() to /home/myusername/my_site *** WARNING: you are running uWSGI without its master process manager *** your processes number limit is 3898 your memory page size is 4096 bytes detected max file descriptor number: 1024 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uWSGI http bound on :8080 fd 4 spawned uWSGI http 1 (pid: 20358) uwsgi socket 0 bound to TCP address 127.0.0.1:45939 (port auto-assigned) fd 3 Python version: 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170118] Set PythonHome to /home/myusername/Env/my_site *** Python threads support is disabled. You can enable it with --enable-threads *** Python main interpreter initialized at 0x55c1438a1920 your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 60 seconds mapped 72904 bytes (71 KB) for 1 cores *** Operational MODE: single process *** ImportError: No module named 'my_site' unable to load app 0 (mountpoint='') (callable not found or import error) *** no app loaded. going in full dynamic mode *** *** uWSGI is running in multiple interpreter mode *** spawned uWSGI worker 1 (and the only) (pid: 20357, cores: 1)
How do I figure out what my "internal server error" debug log says? And how do I fix that error so that my Wagtail-powered website displays when I navigate to my Linode server in my browser?
Something's up with how uWSGI is configured, this is likely the cause of your internal server error:
ImportError: No module named 'my_site'
The application you're trying to load isn't getting loaded, so uWSGI can't serve responses from the application. What version of python is your application? Did you install the proper uWSGI version to match your virtual environment? You would install with either pip for python2 or pip3 for python3.
Try starting uwsgi again and see if you can get that ImportError resolved.