What directory structure should i set up for my Django project?

Posted on 2015-01-20
Last Modified: 2015-01-21
I was wondering what the best directory structure would be for my Django project? I am only building one responsive website which will link to 3rd party APIs and use mapping. I have created a project from the command line which then created a sub directory of the same name. Should that second directory be at the same level as a new app folder that I want to create or should i put the app within that sub folder? I am getting confused since the file is in the sub directory for the project and I have no settings file in my app folder.

So is the attached correct and if so does the app folder inherit the settings from the Dango_project(n1) settings file?

Question by:lz7cjc
1 Comment
LVL 16

Accepted Solution

gelonida earned 500 total points
ID: 40560837
To create a new django project:
you type
django-admin startproject mypjt

Open in new window

The directory tree will be something like this:

Open in new window

mypjt/ will be the path for your entire django project and will also contain the script, which you shall use for any further activities concerning this project.

mypjt/ will also be the directory to put in your pythonpath. imports will be relative to that path.

is the directory containing all settings and the top level file you can see this as kind of the top level application.

Let's now create your django application (you could create more than one app belonging to this project if you like to,

python mypjt/ startapp myapp

Open in new window

Alternatively you could type.
cd mypjt
 python startapp myapp 

Open in new window

the directory tree looks now:

Open in new window

you see that your django application is now located  in mypjt/myapp.

This is the default directory structure for django 1.4 (and I think also for some newer versions)
the structure for django 1.3 was different.

Hope that helps

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Installing Python 2.7.3 version on Windows operating system For installing Python first we need to download Python's latest version from URL" " You can also get information on Python scripting language from the above mentioned we…
There is a huge demand for CodeIgniter among the PHP web developers due to its dynamic features and benefits these days. It is one of most popular and agile open source PHP framework for creating robust web applications in PHP web development field.…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…

939 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now