我应该如何在生产中设置我的Django项目树

时间:2018-01-27 05:46:11

标签: python django git digital-ocean

我已将我的Django repo从开发转移到我的远程DigitalOcean服务器上,准备投入生产。我的问题是 - 我在哪里放置我的应用程序,manage.py等?

我当前的树看起来像这样:

路径:/home/zorgan/project

目录的内容是:env manage.py static app

所以我从Bitbucket导入了app,这是我的回购。这包含我的代码,包括manage.py等。我是否使用此manage.py或在外部文件夹中使用manage.py?我是否删除app目录altogethor并将其内容(我的所有应用)放在/home/zorgan/projectenv等旁边的static内?

反馈意见。

1 个答案:

答案 0 :(得分:0)

我认为这是Django项目的最佳布局之一:

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

我建议你阅读原文post