2

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.

3
  • does the project have a requirements file? If so, did you run it? Commented Nov 9, 2014 at 17:07
  • the requirements file is a text file. how will it run? Commented Nov 10, 2014 at 6:29
  • requirements.txt list all of the dependencies that need to be imported. Its often best to use virtualenv to separate project from other projects. use pip to import requirements. Commented Nov 10, 2014 at 16:23

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

I just have a mod_wsgi.so from where can i get the django wsgi. Also where can I find the httpd-wsgi.conf.
And you must add your project module to sys.path.
0

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

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.