16

I am very new to web development, just wanted to figure out if there is a recommended(preferred) project folder structure to use (may be even specific to Django based projects).

Thank you.

Greg
  • 227
  • 1
  • 2
  • 9
  • `django-admin.py` and `manage.py` give you a folder structure already, what are you unsure about? – Ben James Feb 17 '10 at 15:47
  • As Ben said, the default structure that Django creates is sufficient for a "typical" project. If you want to deploy in an Apache/(nginx|lighttpd) environment, there are several tutorials out there to get you started. However, since you say you're new to web development you might want to leave that part of your project to someone more familiar with server configuration, especially because an improperly configured folder structure might expose your project to security risks. – nikola Feb 17 '10 at 16:05
  • Thanks guys. I'm starting to get my head around this – Greg Feb 17 '10 at 21:20

2 Answers2

14

I think the folder structure and other best practices are covered by Lincoln Loop's Django Best Practices document.

They even have a project on github to auto generate the layout in their recommended structure.

I think it is very similar and in line with the Pinax recommendations; but you might want to verify this part.

lprsd
  • 84,407
  • 47
  • 135
  • 168
5

I've seen a few opinions on this:

If you're new to web development though, you might want to consider just using the folder structure django-admin and manage.py give you (as Ben suggests). That will let you learn how to write a web app, and you can move the files around later as you need.

Tom Dunham
  • 5,779
  • 2
  • 30
  • 27
  • 20
    I don't think you understand why people are having issues. For someone new to django, the standard way django-admin/manage build the directory structure don't make 100% clear sense. If I have a project name "ex" then an app named "blog", manage.py puts them both together ex > ex + blog. You put urls.py in ex. You put models.py in blog. But then django debug says 'Could not import ex.views.blogs. Parent module ex.views does not exist.' Even though your urls.py has "ex.blog.views.blogs" every time. You see how little sense manage.py makes? – Dexter Jul 28 '12 at 20:05
  • i don't get it. i have only one "app". why the mandatory separation between "app" and the "project" directory? – Berry Tsakala Dec 30 '15 at 21:05