startapp with manage.py to create app in another directory

前端 未结 6 891
谎友^
谎友^ 2021-01-31 14:25

My Django project structure is:

/proj
  /frontend
  /server
    /proj
    /app1
    /app2
  manage.py

How do I run python ma

6条回答
  •  无人及你
    2021-01-31 14:52

    I always have my app in an internal folder (the same that Django creates, with the name of the project) following the design of Two Scoops of Django that is similar to what you want to do. When you want to create a new app, you can use, as the previous answer says,

    python ../manage.py startapp my_new_app
    

    from within the folder in which you want to create the app. Another thing, even easier that is what I do, is that you can run

    django-admin startapp my_new_app
    

    from this inner folder, of apps and it will work.

提交回复
热议问题