All Projects → richytong → django-boilerplate-3.6.1

richytong / django-boilerplate-3.6.1

Licence: other
Django served by Gunicorn running behind Nginx reverse proxy. Deploy to AWS Elastic Beanstalk with Fabric3!

Programming Languages

python
139335 projects - #7 most used programming language
Dockerfile
14818 projects
shell
77523 projects

Projects that are alternatives of or similar to django-boilerplate-3.6.1

boss
Deploy like a boss.
Stars: ✭ 35 (+169.23%)
Mutual labels:  deployment, fabric
go-gin-web-server
Deploy Go Gin on Render
Stars: ✭ 23 (+76.92%)
Mutual labels:  deployment, webserver
kuzgun
simple, ssh based deployment tool
Stars: ✭ 16 (+23.08%)
Mutual labels:  deployment, deployment-strategy
Caprover
Scalable PaaS (automated Docker+nginx) - aka Heroku on Steroids
Stars: ✭ 7,964 (+61161.54%)
Mutual labels:  deployment, webserver
Loom
Elegant deployment with Fabric and Puppet.
Stars: ✭ 115 (+784.62%)
Mutual labels:  deployment, fabric
Fabric Home Assistant
📜 Deploy Home-Assistant easily with Fabric
Stars: ✭ 94 (+623.08%)
Mutual labels:  deployment, fabric
Fabric Bolt
Fabric deployments via a web interface
Stars: ✭ 419 (+3123.08%)
Mutual labels:  deployment, fabric
Deploy
Ansible role to deploy scripting applications like PHP, Python, Ruby, etc. in a capistrano style
Stars: ✭ 2,141 (+16369.23%)
Mutual labels:  deployment, deployment-strategy
fabalicious
is now deprecated and not supported anymore, use https://github.com/factorial-io/phabalicious instead
Stars: ✭ 14 (+7.69%)
Mutual labels:  deployment, fabric
natural
Fastest Framework for NodeJS. Written in pure ES6+
Stars: ✭ 30 (+130.77%)
Mutual labels:  webserver
old-animations
Client-side modification for Fabric that allows users to restore animations from older versions.
Stars: ✭ 19 (+46.15%)
Mutual labels:  fabric
fabric-loom
Gradle build system plugin used to automate the setup of a minecraft mod development environment.
Stars: ✭ 150 (+1053.85%)
Mutual labels:  fabric
aws-syndicate
Syndicate deployment framework
Stars: ✭ 48 (+269.23%)
Mutual labels:  deployment
NaturesCompass
A Minecraft mod that allows you to search for a biome's location anywhere in the world and view information about it.
Stars: ✭ 42 (+223.08%)
Mutual labels:  fabric
ionic-workflow-guide
Create a full and powerful worflow with Ionic (Unit Testing, Environment variables, Automatic documentation, Production App Server, Automatic deployment)
Stars: ✭ 46 (+253.85%)
Mutual labels:  deployment
rust-web-boilerplate
An implementation of a simple web server using Rust
Stars: ✭ 36 (+176.92%)
Mutual labels:  webserver
fabric-example-mod
An elegant Minecraft mod template for the Fabric mod loader
Stars: ✭ 25 (+92.31%)
Mutual labels:  fabric
bdk
Streamlined blockchain deployment kit for Hyperledger Fabric.
Stars: ✭ 43 (+230.77%)
Mutual labels:  fabric
MemoBoard
Flask and React based intranet app where you can create and share lists (e.g. shopping list, todo, ...)
Stars: ✭ 35 (+169.23%)
Mutual labels:  webserver
daisykit
Daisykit is an easy AI toolkit for software engineers to integrate pretrained AI models and pipelines into their projects. - with NCNN, OpenCV, Python wrappers
Stars: ✭ 22 (+69.23%)
Mutual labels:  deployment

Django Boilerplate for Python 3.6.1

This Django Boilerplate quickly encapsulates your source code in a Docker container running Gunicorn behind an Nginx reverse proxy. This project uses Fabric3 to handle most of the deployment and administration tasks.

container-diagram.png

Prerequisites

pip - You can install pip with Homebrew

brew install pip

I recommend you use pyenv to manage your versions of python as well as any dependencies installed by pip.

brew install pyenv pyenv-virtualenv

Docker - Install docker here

Setup

pip install -r requirements.txt

You configure

installed apps - /src/config/settings/init.py

You can find your installed apps in INSTALLED_APPS.
When you add a Django app, remember to specify it here.

project-wide credentials and keys - /src/config/settings/defaults/credentials.py

Place credentials for any external services used here.
For example: APIAI_CLIENT_ACCESS_TOKEN = 'alsdfalsjlakjf'

database declaration - /src/config/settings/defaults/database.py

Specify your database configurations in DATABASES. Default here is sqlite but
it is highly recommended to use a relational database like PostGresQL.

settings modules - /src/config/settings/

Your deployment-specific settings. Ensure DB_MAIN corresponds to keys you specified in
database.py DATABASES. DB_MAIN specifies the database used by the different deployments
{'test_dev', 'staging', 'production'} of your application. This is convenient for
isolated deployments of your application at the data layer, but you can also point
DB_MAIN to the same database for all deployments of your application.

Fabric3 - /fabfile.py

Fabric is a simple, Pythonic tool for remote execution and deployment. It is more powerful
than a simple bash script or Makefile. Read more [here](https://github.com/mathiasertl/fabric/).

	region       - Region on AWS hosting your servers

	image        - Title of your image. This follows the format __name__:__version__.
	               Version defaults to 'latest'
	
	account      - Your AWS account. This is given to you when you created your account with AWS
	               and is necessary to log in to the AWS console.
	
	endpoint     - AWS path representation of your AWS docker repository.
	               Images are pushed here and tagged as this.

	environments - Dictionary mapping {'staging, 'production'} to the environments you
	               created on the AWS console.

Build your project

Start adding apps to the src directory.

python src/manage.py startapp __your_custom_app__

Run your project locally

This is shorthand for python src/manage.py runserver

fab start:dev

Run a container locally

Build the Docker image. You must specify which deployment {'staging', 'production'} to build. Here we build a staging image.

fab build:staging

Clean up old images. If this is your first build you will not need to use this.

fab clean

Run your container. The container will run on port 80 by default. You can find your project on http://localhost/. Check static files are serving correctly with http://localhost/admin (if it is ugly, something went wrong)

fab start

Optionally, attach to your running container and run bash at your leisure. You can exit your container at any time using exit

fab attach

Ctrl + c does not stop your container so it will run in the background unless you stop it manually.

fab stop

Deploy your project to AWS Elastic Beanstalk

Login to AWS

fab login

Transfer your Docker image to the AWS repository

fab push

Use eb cli to deploy your project for a specified deployment {'staging', 'production'}. If this is your first deployment you must run aws configure and eb config and supply the necessary arguments and credentials. This command also generates the Dockerrun.aws.json file needed for AWS Elastic Beanstalk deployment

fab eb:staging

References

http://kimh.github.io/blog/en/docker/gotchas-in-writing-dockerfile-en/ https://medium.com/@rohitkhatana/deploying-django-app-on-aws-ecs-using-docker-gunicorn-nginx-c90834f76e21 https://realpython.com/blog/python/django-development-with-docker-compose-and-machine/ https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-14-04 https://docs.docker.com/engine/reference/builder/ moby/moby#6822 (comment) https://www.twoscoopspress.com/products/two-scoops-of-django-1-8 http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.logging.html

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].