ljrh
ljrh

Reputation: 449

Using nginx and gunicorn to serve django

I am receiving the error:

ImportError at /
No module named Interest.urls

even though my settings file has been changed several times:

ROOT_URLCONF = 'urls'

or ROOT_URLCONF = 'interest.urls'

I keep getting the same error, as if it doesn't matter what I put in my settings file, it is still looking for Interest.urls, even though my urls file is located at Interest(django project)/interest/urls.py

I have restarted my nginx server several times and it changes nothing, is there another place I should be looking to change where it looks for my urls file?

Thanks!

Upvotes: 1

Views: 165

Answers (2)

chachan
chachan

Reputation: 2452

There's not need to restart nginx, you can do these steps:

  1. Install fabric (pip install fabric)
  2. Create a "restart" function into fabfile.py that has the following:

    def restart(): sudo('kill -9 `ps -ef | grep -m 1 \'[y]our_project_name\' | awk \'{print $2}\'`')

  3. Call the function through:

    $ fab restart

  4. Optional, you might want to add the command into a script with your password just adding "-p mypass" to fabric command

That will kill all your gunicorn processes allowing supervisord to start them again.

Upvotes: 0

ljrh
ljrh

Reputation: 449

I had to restart my supervisorctl, which restarted the gunicorn server which was actually handling the django files

Upvotes: 1

Related Questions