简体   繁体   中英

How I should set up my Django project tree in production

I've moved my Django repo from development onto my remote DigitalOcean server ready for production. My question is - where do I put my apps, manage.py etc?

My current tree looks like this:

path: /home/zorgan/project

and the contents of the directory is: env manage.py static app

So I imported app , which is my repo, from Bitbucket. This contains my code including manage.py etc. Do I use this manage.py or do I use the manage.py in the outer folder? Do I remove the app directory altogethor and simply put it's contents (all my apps) inside /home/zorgan/project next to env , static etc?

Feedback appreciated.

I think this is one of the best layout for a Django project:

myproject/
manage.py
myproject/
    __init__.py
    urls.py
    wsgi.py
    settings/
        __init__.py
        base.py
        dev.py
        prod.py
blog/
    __init__.py
    models.py
    managers.py
    views.py
    urls.py
    templates/
        blog/
            base.html
            list.html
            detail.html
    static/
       …
    tests/
        __init__.py
        test_models.py
        test_managers.py
        test_views.py
users/
    __init__.py
    models.py
    views.py
    urls.py
    templates/
        users/
            base.html
            list.html
            detail.html
    static/
        …
    tests/
        __init__.py
        test_models.py
        test_views.py
 static/
     css/
         …
     js/
         …
 templates/
     base.html
     index.html
 requirements/
     base.txt
     dev.txt
     test.txt
     prod.txt

I suggest you to read the original post

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM