Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple Django Project Structure

I have built the virtual environment and root directory for my django project, which will be a simple website for a event venue. The site will simply have a few different tabs on the navigation bar which shows the user some of the venue specifics which include pricing, a photo gallery, and the venue's history.

My problem is that there is so much conflicting information on the web concerning "The best practice for project structure".

Should I create an app for the home page and each of the pages that follow, or just create a core app that houses the majority of the project? If this is the case, is this project a good example? --> https://github.com/justdjango/django-ecommerce

Does anyone know of a simple project that I can reference?

Again this is a pretty simple project with only a few urls and no forms.

I would greatly appreciate anyone who has taken the time to read through this and help me.

like image 865
wisenickel Avatar asked Mar 27 '26 09:03

wisenickel


1 Answers

in my opinion you just need one app let's call it web since it is used for website only. The steps I follow in creation of a simple project after creating repository and database and make it running is:

  1. Create static, media and templates folders
  2. python manage.py startapp web
  3. Add web in INSTALLED_APPS in settings.py file
  4. Put html files in templates folder and other folders(js,css,images,fonts..) in static folder
  5. Set URL to the new app in project_name > urls.py
  6. Create view for index page in web.views
  7. Create url to the view just created in web.urls
  8. Change every links of images, js and css files in index.html to static url as to use in python. {% load static %} is must
  9. The page will be loaded in localhost now.
  10. create other views and set urls in web app to other pages like about,contact and so on
  11. Create a list of models You will need and define them in web.models
  12. pass them to admin page by using web.admin
  13. Make it dynamic by passing data from models to templates.

hope you get it right

like image 87
Pulath Yaseen Avatar answered Mar 29 '26 21:03

Pulath Yaseen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!