Cannot start any django app

前端 未结 14 1833
离开以前
离开以前 2021-01-02 06:22

I am a newbie at Django and everytime I try to run python panel/manage.py startapp %app% (panel is my project) it gives me the error:

Error: \'         


        
14条回答
  •  忘掉有多难
    2021-01-02 06:55

    It's the process how I got my doubt clear.

    First, I created a directory inside my project directory and put __init__.py, models.py, admin.py, apps.py & views.py.

    Then I ran python manage.py runserver & It work well.

    Then as suggested on that page I used startapp command. I got this error :

    CommandError: 'ucportal' conflicts with the name of an existing Python 
    module and cannot be used as an app name. Please try another name.
    

    After that I deleted that directory and ran startapp command with same name and it worked fine.

    So 'startapp' command is to create an app automatically. If you already have one there, it fails.

    Answer given by @DAG worked for me.

提交回复
热议问题