On 22/08/2011 1:22am, Jim wrote:
I tried
../manage.py startapp someapp
under apps/, but that created the someapp under mysite/ rather than
under apps/.
That's what is expected.
mysite should contain settings.py and mysite/apps should contain
models.py (among other files). If you want a separate database to
contain data used by all applications there is nothing wrong with
creating a new subdirectory mysite/common (someone here felt that
"global" might be a reserved word) and copying the contents of
mysite/apps into mysite/common. Then in settings.py put mysite.apps and
mysite.common into INSTALLED_APPS.
I would adjust the name "apps" to something more specific for a single
app. You can have a dozen app directories under mysite if you like. In
fact that is good. Segregate your project into as many stand-alone apps
as you feel comfortable doing - but they should all be at the same level
for keystroke minimisation when importing.
---- mysite (settings.py, urls.py etc)
---- ---- app1 (models.py, urls.py etc)
---- ---- app2 (urls.py)
---- ---- ---- models (whatever.py containing just the whatever model)
---- ---- app3(models.py)
---- ---- ---- urls (this.py containing just the this urls)
---- ---- ---- views (lots of files keeping your views under control)
Because you import the bits and pieces as required it is best to keep
things as flat as dictated by the inherent complexity of your project.
In the diagram above, app1 is fairly simple, app2 has many complex
models so you put them into separate files in a models sub-dir, while
app3 has simple models but lots of complex urls which would be best in a
separate urls directory and likewise for app3's views.
hth
Mike
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.