Cannot start any django app

前端 未结 14 1762
离开以前
离开以前 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.

提交回复
热议问题