Skip to content

AliBigdeli/Django-Heroku-Template

Repository files navigation

Django Heorku Template Project

A simple start for any heroku project

python django sqlite bootstrap html5 sqlite heroku

Overview

Goal

This project main goal is to provide a way to deploy django applications by using heroku ,gunicorn or even using one click deployment.

Setup

To get this repository, run the following command inside your git enabled terminal

git clone https://github.com/alibigdeli/Django-Heroku-Template

Getting ready

Create an enviroment in order to keep the repo dependencies seperated from your local machine.

python -m venv venv

Make sure to install the dependencies of the project through the requirements.txt file.

pip install -r requirements.txt

Once you have installed django and other packages, go to the cloned repo directory and run the following command

python manage.py makemigrations

This will create all the migrations file (database migrations) required to run this App.

Now, to apply this migrations run the following command

python manage.py migrate

options

Project it self has the user creation form but still in order to use the admin you need to create a super user.you can use the createsuperuser option to make a super user.

python manage.py createsuperuser

And lastly let's make the App run. We just need to start the server now and then we can start using our simple todo App. Start the server by following command

python manage.py runserver

Once the server is up and running, head over to http://127.0.0.1:8000 for the App.

Reformat and check

If you want your code to be check by pep8 and all the guide lines, there are two packages added to requirements in order to check and reformat code. you can use it by this command:

black -l 79 . && flake8

Repo Features

  • Latest LTS Django3.2
  • Latest LTS included 3.2.x and needed requirements

  • Git
  • python gitignore and README with license

  • Django env
  • enviroment sample file and setup

  • Base Restframework Authentication and Token
  • A simple login and registration page for starting project and testing

  • Black
  • Reformating your codes to standard projects

  • Travis and Flake8
  • Included with travis.yml configuration file for test purposes.plus included Flake8 and config files.

  • Preconfigured
  • Preconfigured settings.py for db,static,media etc.

Configurations

  • Static & Media Directories
  • STATIC_ROOT and STATIC_URL and same for media configurations with STATICFILES_DIRS

  • Template Directories
  • Genral templates directory for root

  • Site Framework and Sitemaps + robots
  • Siteframework as in site_id configs with robots.txt and sample sitemaps

  • Database Configs
  • Database configuration for production with postgresql and volume directory in data

  • Email Configs
  • Email configurations for dev and prod as in env file

  • Message Configs
  • Message and warnings configuration for notification handelings

  • Hints and Files
  • Sample files and hints all over the template for giving more pace

  • Security
  • Security tags for https and redirections,HSTS,Cookie and other headers

Deploy with HerokuCLI

https://devcenter.heroku.com/articles/git

Deploy with Github

https://devcenter.heroku.com/articles/git

Deploy with OneClick

https://devcenter.heroku.com/articles/heroku-button