Arun Raja
Arun Raja

Reputation: 1674

Existing Django project deployment using Apache and Mod_wsgi (windows)

I have a django project which I took it from github. I would like to run the project on my local using apache server. I have installed apache and want to run the project. But I am always getting this error.

 raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s"
% (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'core.settings' (Is it on sys.path?): No
module named cms.models

Please find the configuration I am using.

Python 2.7 
Django 1.4 
database in postgres

I have a project under mysite which is having the module name as core. There is also a setting files, but I dont know why it is not getting referred. I am also not able to sync with the database. I have been searching for a tutorial which gives me details of deploying a existing django project in localhost. I am able to create a new django project and able to run it in the default port.

Upvotes: 2

Views: 598

Answers (2)

geekops
geekops

Reputation: 515

This error will occur if you have not appended cms.modules to the sys.path.

Use sys.path.append(/project folder path/cms.modules)

Upvotes: 0

imotai
imotai

Reputation: 2086

You should add the project code to PYTHONPATH.

The normal configuration steps:

  1. add a django.wsgi

    import os, sys
    sys.path.append('your project module path')# set PYTHONPATH
    os.environ['DJANGO_SETTINGS_MODULE'] = 'core.settings'
    import django.core.handlers.wsgi
    application = django.core.handlers.wsgi.WSGIHandler()

  2. add django.wsgi to httpd-wsgi.conf

    WSGIScriptAlias / django.wsgi #your djang.wsgi path

Upvotes: 1

Related Questions