cannot open manage.py after installing django

后端 未结 13 978
暗喜
暗喜 2021-02-04 11:23

I have a problem in setting up django.

My situation: I have Anaconda Python 2.7 in my Windows 8 computer. On the Anaconda command prompt window, I type: pip instal

相关标签:
13条回答
  • 2021-02-04 11:58

    The reason of this problem is because you're in the first project directory "parent directory", and you have to go to your project "newproject" that has the manage.py file.

    The way to this is simple:

    1. cd "name of your project", E.g. cd newproject

    2. python manage.py runserver

    0 讨论(0)
  • 2021-02-04 11:58

    I ran into the same error seller. But this is what I discovered

    1: open your terminal in your project environment

    2: install Django using: pip install django (if you are on windows)

    3: then create your Django project using : django-admin startproject newproject . (django-admin start-project followed by project name give a space and add period (.) ) So it goes like this

    django-admin startproject new project .

    The period/fullstop (.) At the end tells djando the area in which the file should be created which is inside the project file its self you are working on. After this is done you are free to go. You can now run your server and enjoy

    Run server using: python manage.py runserver

    0 讨论(0)
  • 2021-02-04 12:01

    you need to change your directory to the directory of the project.

    1. open your environment by typing activate environment_name
    2. change the directory to the folder in which you want to create the project by cd Folder_Name
    3. then create your project by django-admin startproject Project_Name
    4. then change the directory to your project folder
    5. if you also want to create an app then typepython manage.py startapp App_name
    6. to confirm if it works type python manage.py runserver, then you should get a link in the terminal. copy and paste that link in the browser and you should see a successful page.
    0 讨论(0)
  • 2021-02-04 12:01

    You should navigate to the inner directory where your manage.py resides. For example: If you have created projectname as Django-admin startproject loginapp

    Step 1: Go to loginapp
    Step 2: Click on it
    Step 3: You will find another loginapp and manage.py folder inside that
    Step 4: Use this rootpath commandprompt
    Step 5: Enter py manage.py runserver
    Now it will work

    0 讨论(0)
  • 2021-02-04 12:02

    You are not in the correct directory. You need to do cd newproject and the execute your runserver command.

    0 讨论(0)
  • 2021-02-04 12:03

    You need to include a . after you create the project.

    Eg: django-admin.py startproject newproject .

    This will allow you to run python manage.py runserver from where you are.

    0 讨论(0)
提交回复
热议问题