"uWSGI Error Python application not found" after trying to add a subdomain to Nginx

5,078

My mistake here was an improperly renamed module in my Django project.

I changed mydomain.mydomain to mydomain.myd so then uWSGI was looking for a module named mydomain.mydomain and then the wsgi.py file instead of mydomain.myd.wsgi which is where it had been.

Share:
5,078

Related videos on Youtube

markwalker_
Author by

markwalker_

I'm a Python (Django) developer, maintainer of a few packages and tech lead of django-cms. #SOreadytohelp django-bleach django-sql-explorer django-sys-indicator

Updated on September 18, 2022

Comments

  • markwalker_
    markwalker_ over 1 year

    Obviously I was wrong to assume adding a subdomain would be as straightforward as duplicating my existing domain & adding a DNS A record.

    So I tried to run cp -r /var/www/mydomain.com/ /var/www/dev.mydomain.com & configure a subdomain from the original domain settings, but now it gives a 'Python application not found' error on my original domain.

    I have a VDS running Ubuntu, Nginx and uWSGI to serve Django with the following configuration;

    /var/www/mydomain.com
    - /conf
    -- /nginx.conf
    -- /uwsgi.conf
    - /logs
    - /src
    - /venv
    

    Nginx is setup to read configs from /var/www/*/conf/nginx.conf

    uWSGI is set to startup with a Daemon and this is my uwsgi.conf;

    [uwsgi]
    # variables
    projectname = mydomain
    projectdomain = mydomain.com
    base = /var/www/mydomain.com
    
    # config
    plugins = python
    master = true
    protocol = uwsgi
    env = DJANGO_SETTINGS_MODULE=%(projectname).settings
    pythonpath = %(base)/src/%(projectname)
    module = %(projectname).wsgi
    #module = mydomain.wsgi
    #module = mydomain.wsgi:application
    #socket = /tmp/%(projectdomain).sock
    socket = 127.0.0.1:8889
    logto = %(base)/logs/uwsgi.log
    # below line runs as a daemon in background
    daemonize = /var/log/uwsgi/mydomain.log
    

    And I've pastebined my uwsgi domain log if it helps

    I'm still new to uwsgi/nginx (if you hadn't guessed!) so could anyone offer a suggestion for my problem or could I provide some more detail?

    • singer
      singer almost 11 years
      What version of django are you using?
    • markwalker_
      markwalker_ almost 11 years
      @singer I'm using 1.5.1