On Feb 6, 1:17 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> I'm just getting started, so please bear with me. How should I
> organize my website? I haven't seen a definitive example of where to
> put settings files, templates, applications, images, stylesheets, etc.
>
> My best guess would be something like:
>
> /website_root
> /source
> settings.py
> urls.py
> __init__.py
>
> /templates
> /images
> /stylesheets
> /javascripts
> base_template.html
> some_other_template.html
>
> /app1
> model_name.py
> etc
>
> Is this even close? I know the structure is up to me, but I'd like to
> establish a good pattern for organization.
>
> Thanks for your advice!
>
> Brandonwww.btaylordesign.com
This is fairly close to what I'd do, but with two important
exceptions.
One, *don't put your code in your website root*! It does not need to
be read by your webserver, and shouldn't be accessible for external
users - that's a big security risk (imagine someone browsing to your
settings.py and reading your database password). Put it in your home
directory, or a central code area, but not under your Apache root.
Secondly, don't put your images/JS/CSS in the same place as your
templates. Templates, like code, don't need to be accessible to the
webserver. Put them in the same place as the Python code - either a
general templates/ directory based at the same root as your project
source, or separate templates directories under each app. Some people
prefer one, some the other - it's up to you.
But images, JS and CSS *do* need to be accessible to whatever method
you're using to serve them - don't forget, Django won't do that for
you. So if you want to keep them with your code, you can symlink them
to your Apache directory - but that will be easier if you put them in
their own directory, called something like /site_media/.
--
DR.
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---