Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7194883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:27:56+00:00 2026-05-28T20:27:56+00:00

I am planning a new Django project and want to get everything right and

  • 0

I am planning a new Django project and want to get everything right and stuff. I stumbled over the question of how to organize the project directory layout. Luckily, there are quite a few examples of good project templates out there in the web. Still, there is one thing I struggle to get in my head:

It is the recommended way to put template files into a separate directory under the project root that is divided into subdirectories by apps. So, templates are not located within the app directories. That seems logical to me since we want to separate application logic from representation logic. But what about static files? Here, the common practice seems to be to locate the static files within the app dirs and load them into a ‘static’ directory under the project root at development time (collectstatic). And this logic I do not understand. Since static files (i.e. js, css, images) are usually accessed within templates, not within application code, I would count them to presentation logic. Then why aren’t they stored just like templates are – a directory under the project root, with subdirectories for the single apps?

I know I can store these files wherever I want but I guess there might be a good reason why folks are doing it this way. What could this reason be?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T20:27:57+00:00Added an answer on May 28, 2026 at 8:27 pm

    Static files can be put in the related app in the same way that templates related to a specific app are often put in the application directory.

    Sometimes, it makes sense. Sometimes, it doesn’t – it’s your call.

    For example, I put my static media in a site_media directory (global css, global images, etc) but put app specific media in app/static. For example, if I have a Poll app, there’s a good chance that my media is only needed for the Poll app templates, and not my site index.

    The same goes for templates: I put my global templates (base.html) in a global template directory, but app specific templates go in myapp/templates/myapp/foo.html.

    Finally, it particularly makes sense for pluggable apps. For example, django’s static files are stored in the app but becomes accessible in your static files directory even though the app lives somewhere on your python path. Previously, you would have had to copy the media directory or symlink to it.

    The staticfiles app really shines because it lets you organize all files related to an application in one place: the application folder. collectstatic takes care of the rest, and makes it all available at one location for a web server.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently planning a new web project. Clients are going to connect using a
I'm planning a new ASP.NET project that will become a product that is installed
I'm planning a new service for my ASP.NET MVC app and want to use
I'm planning a new side-project that will ultimately involve analyzing data I collect. It's
I'm fairly new to web development and Django so bear with me. I'm planning
I'm planning a new build system for our project running on Centos 5.4. I
I am new to python and I am planning to learn django. I had
I am new to android and I am doing some project planning. To finish
There is a new project that I am planning to start in few days
We're planning a new project which will feature an API available to customers to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.