Git Product home page Git Product logo

djboilerplate's Introduction

Dj Boilerplate

Ruff VSCode GitHub

A Django boilerplate/template for building production level projects

Features

Frontend

Backend

  • Decouple, for securely storing secret variables in .env file
  • Pillow, for uploading images

Getting Started

Follow the steps to get your app running

  • git clone https://github.com/almahdi404/djboilerplate

  • Rename the djboilerplate folder name with your new project name

  • cd into the project folder

  • On Linux/Mac :

    • Run : bash setup.sh

    • Activate the virtual environment : source env/bin/activate

  • On Windows :

    • Create a virtual environment named env : python -m venv env

    • Activate the virtual environment : env/Scripts/activate

    • Install the dev requirements : pip install -r requirements/dev.txt

    • Duplicate the .env.example file and rename the new file to .env

    • Inside the .env file, set ENV=dev

    • Generate a random SECRET_KEY : python manage.py genskey, copy it

    • Inside the .env file, set it as the SECRET_KEY value

  • Start the server : python manage.py runserver

  • Go to localhost:8000 to see your project running

How it works

  • Settings
    • the settings module is divided into base.py , dev.py , pro.py files. both dev.py and pro.py extends the base.py file
    • when using python manage.py runserver, dev.py is used if ENV=dev and pro.py is used if ENV=pro
    • pro.py is always used in wsgi and asgi application
    • secret variables are imported from .env file using the decouple.config function
  • Apps
    • all apps are stored in the apps folder for structural convenient
    • use python manage.py newapp appname to create new apps inside the apps folder
  • Sass
    • a compiler function in apps/core/sass.py is called when the server is started or reloaded
    • when DEBUG=True, it will watch for .scss file changes in static folders and compile it, threading is used to accomplish this task
    • when DEBUG=False, then it will compile all .scss files in STATIC_ROOT once

Contribute

If you wish to contribute to this project, please first discuss the change you wish to make via an issue.

License

MIT License

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.