Pablo Estrada
Pablo Estrada

Reputation: 3452

Deploying Project in PythonAnywhere. Settings Module Import Errror

I´m trying to deploy my django 1.6.4 project on pythonAnywhere using python 2.7

I already configured a virtual enviroment and the wsgi file according to the guidelines on the website. But I´m getting a 404 when I check the site. The error lol tells me this:

ImportError: Could not import settings 'tango_with_django_project.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named tango_with_django_project.settings

Here´s my wsgi:

# +++++++++++ DJANGO +++++++++++

# TURN ON THE VIRTUAL ENVIRONMENT FOR YOUR APPLICATION
activate_this = '/home/pjestrada/.virtualenvs/rango/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))

# To use your own django app use code like this:
import os
import sys
#
## assuming your django settings file is at '/home/pjestrada/mysite/settings.py'
path = '/home/pjestrada/rango/tango_with_django_project'

if path not in sys.path:
    sys.path.append(path)

os.chdir(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'tango_with_django_project.settings'
#
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

My tree:

├── Dropbox
│   ├── README.txt
│   └── __init__.py
├── README.txt
└── rango
    ├── LICENSE
    ├── README.md
    └── tango_with_django_project
        ├── manage.py
        ├── media
        │   ├── profile_images
        │   │   └── 10411981_634016890008979_1609187547738555774_n.jpg
        │   └── rango2.jpg
        ├── populate_rango.py
        ├── rango
        │   ├── __init__.py
        │   ├── __init__.pyc
        │   ├── admin.py
        │   ├── admin.pyc
        │   ├── bing_search.py
        │   ├── bing_search.pyc
        │   ├── forms.py
        │   ├── forms.pyc
        │   ├── models.py
        │   ├── models.pyc
        │   ├── tests.py
        │   ├── urls.py
        │   ├── urls.pyc
        │   ├── views.py
        │   └── views.pyc
        ├── static
        │   ├── about.jpg
        │   ├── css
        │   │   ├── bootstrap-fluid-adj.css
        │   │   ├── bootstrap-responsive.css
        │   │   ├── bootstrap-responsive.min.css
        │   │   ├── bootstrap.css
        │   │   └── bootstrap.min.css
        │   ├── img
        │   │   ├── glyphicons-halflings-white.png
        │   │   └── glyphicons-halflings.png
        │   ├── js
        │   │   ├── bootstrap.js
        │   │   ├── bootstrap.min.js
        │   │   ├── jquery-2.1.1.js
        │   │   └── rango-ajax.js
        │   └── rango.jpg
        ├── tango_with_django_project
        │   ├── __init__.py
        │   ├── __init__.pyc
        │   ├── settings.py
        │   ├── settings.pyc
        │   ├── urls.py
        │   ├── urls.pyc
        │   └── wsgi.py
        └── templates
            └── rango
                ├── about.html
                ├── add_category.html
                ├── add_page.html
                ├── base.html
                ├── category.html
                ├── category_list.html
                ├── index.html
                ├── login.html
                ├── page_list.html
                ├── profile.html
                ├── register.html
                ├── restricted.html
                └── search.html

Upvotes: 1

Views: 1713

Answers (1)

thetanuj
thetanuj

Reputation: 397

Try changing value of path.

path = '/home/pjestrada/rango'

That path is your project directory. It worked for me.

Upvotes: 0

Related Questions