Cannot start any django app

前端 未结 14 1578
离开以前
离开以前 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 07:16

    I reproduced the issue and there's actually something not working as I expected. I wonder if we stumbled upon a Django's bug, or a limitation that I don't understand.

    Having a project called "project" and an empty folder app/newapp …I tried:

    python manage.py startapp newapp apps/newapp
    

    It returns:

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

    But if I target ANY other route in which the last folder is not called the same name as the app I'm starting, it works.

    So I ended up doing:

    python manage.py startapp newapp apps/main
    

    Using Django 2.1.3.

    0 讨论(0)
  • 2021-01-02 07:18

    Perhaps you need to

    cd panel
    python manage.py startapp yourappname
    

    I'm not sure running the command from a directory above your project will work properly.

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