我应该在django 1.4中创建django应用程序? [英] Where should i create django apps in django 1.4?

查看:139
本文介绍了我应该在django 1.4中创建django应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在django 1.4中启动了一个新项目,因为他们已经更改了manage.py和整个文件夹层次结构的默认布局(参见 https://docs.djangoproject.com/en/dev/releases/1.4/#updated-default -project-layout-and-manage-py )我无法决定我应该把我的应用程序包放在哪里 - 在 mysite 之外?最好的做法是什么?由于某些原因, startapp 命令会在 mysite 包之外创建应用程序,但这会感觉到错误。



那么最好的是什么?这个:

  manage.py 
mysite /
__init__.py
settings.py
urls.py
myapp /
__init__.py
models.py

或这个:

  manage.py 
myapp /
__init__.py
models.py
mysite /
__init__.py
settings.py
urls.py

解决方案

第二种方法。

  manage.py 
myapp /
__init__.py
models.py
mysite /
__init__。 py
settings.py
urls.py


I've just started a new project in django 1.4 and since they've changed the default layout for manage.py and the whole folder hierarchy (see https://docs.djangoproject.com/en/dev/releases/1.4/#updated-default-project-layout-and-manage-py) i cannot decide where should i put my app packages - inside mysite or outside it? What's the best practice? For some reason, startapp command creates the app outside of the mysite package, but this feels somehow wrong.

So, what's the best? This:

manage.py
mysite/
    __init__.py
    settings.py
    urls.py
    myapp/
        __init__.py
        models.py

or this:

manage.py
myapp/
    __init__.py
    models.py
mysite/
    __init__.py
    settings.py
    urls.py

?

解决方案

The second way.

manage.py
myapp/
    __init__.py
    models.py
mysite/
    __init__.py
    settings.py
    urls.py

这篇关于我应该在django 1.4中创建django应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆