Import Error: No module named django

后端 未结 7 1591
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-30 07:34

I am using centos linux.

I had python 2.6 with django and now i upgraded to python 2.7.
Python 2.6 is located in /usr/lib/python2.6.
Python 2.7 is located i

7条回答
  •  孤城傲影
    2020-11-30 08:19

    try

    pip freeze
    

    this command show which packages are installed in your system then run with root privilege

    pip install django
    

    then create a new project with command

    django-admin.py startproject mysite
    

    then start your project

    cd path/to/mysite
    ./manage.py runserver 
    

    in file wsgi.py add this lines

    import os
    import sys
    DJANGO_PATH =  os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
    sys.path.append(DJANGO_PATH)
    

提交回复
热议问题