All Projects → WoHinDu → django-heroku-skeleton

WoHinDu / django-heroku-skeleton

Licence: other
A modern Django 1.10+ skeleton. Works perfectly with Heroku.

Programming Languages

python
139335 projects - #7 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to django-heroku-skeleton

GitHub-Education-Portfolio
A portfolio made using React and tools from GitHub Student Developer Pack
Stars: ✭ 50 (+233.33%)
Mutual labels:  heroku
CoronaXiv
First Prize in HackJaipur Hackathon 2020 for Best ElasticSearch-based Product! Website: http://coronaxiv2.surge.sh/#/
Stars: ✭ 15 (+0%)
Mutual labels:  heroku
ComBunqWebApp
A Bunq web interface made by bunqers
Stars: ✭ 26 (+73.33%)
Mutual labels:  heroku
heroku-buildpack-activestorage-preview
Official Heroku Rails 5.2 Active Storage Previews Buildpack
Stars: ✭ 21 (+40%)
Mutual labels:  heroku
heroku-buildpack-deno
Heroku Buildpack for Deno
Stars: ✭ 72 (+380%)
Mutual labels:  heroku
ghost-on-heroku
One-button Heroku deploy for the Ghost 3.2.0 blogging platform.
Stars: ✭ 232 (+1446.67%)
Mutual labels:  heroku
cookiecutter-django-herokuapp
A cookiecutter template for creating Django 1.7+ / Python 3 projects quickly, thought optimized for Heroku in the meantime.
Stars: ✭ 20 (+33.33%)
Mutual labels:  heroku
wpacked
📦 WPacked is a WordPress development starter kit with portability and immediate local development in mind.
Stars: ✭ 73 (+386.67%)
Mutual labels:  heroku
heroku-php-extensions
Pre-built PHP extensions for Heroku that are not included or fully supported by the official PHP buildpack.
Stars: ✭ 15 (+0%)
Mutual labels:  heroku
ruby3-rails6-bootstrap-heroku
An opinionated starter application based on Ruby 3.0, Rails 6.1, Webpack 5, Yarn, and Bootstrap 5, deployable on Heroku
Stars: ✭ 21 (+40%)
Mutual labels:  heroku
OpenCV-REST-API
Learn to create a REST API microservice for extracting faces from images using OpenCV, OpenCV-python, Flask, Docker, and Heroku
Stars: ✭ 71 (+373.33%)
Mutual labels:  heroku
tweegeemee
Twitter Genetic Algorithm Imagery
Stars: ✭ 83 (+453.33%)
Mutual labels:  heroku
LocalSupport
A directory of local support services and volunteer opportunities
Stars: ✭ 60 (+300%)
Mutual labels:  heroku
haikunatorgo
Generate Heroku-like random names to use in your go applications.
Stars: ✭ 50 (+233.33%)
Mutual labels:  heroku
bixby
we make your Artweek. we find your Inspiration. 💫
Stars: ✭ 20 (+33.33%)
Mutual labels:  heroku
libDrive
libDrive is a Google Drive media library manager and indexer, similar to Plex, that organizes Google Drive media to offer an intuitive and user-friendly experience.
Stars: ✭ 14 (-6.67%)
Mutual labels:  heroku
mTracker
An email tracker built with Python and Flask
Stars: ✭ 20 (+33.33%)
Mutual labels:  heroku
gitter-bot-how-to
A tutorial on how to make a Gitter Bot
Stars: ✭ 29 (+93.33%)
Mutual labels:  heroku
zeldaPlay
A Single Page Application to help zeldaPlay players to track their characters and progress
Stars: ✭ 95 (+533.33%)
Mutual labels:  heroku
URL-Magnet-Cloud-Uploader-Heroku
Aria 2 Rclone Remote URL /magnet Clouds upload via HEROKU
Stars: ✭ 99 (+560%)
Mutual labels:  heroku

Django Heroku Skeleton

About

A Django skeleton for Django 1.10.3. Build for work with Heroku. In just 15 minutes you get a running Django instance on Heroku.

0. Pre

Notation

In this readme replace:

  • myproject with your project name
  • myapp with your app name
  • yoursecretkey with your secret key
  • myapplink with your Heroku link
  • herokuappname with the name from your Heroku instance
  • githubname with your GitHub username
  • githubrepo with the name from your (new) repo
  • privatesentrydsn with your private Sentry dsn from sentry.io
  • publicsentrydsn with your public Sentry dsn from sentry.io

For Linux:

  • TBD

For Windows:

  • Install Windows PowerShell Link
  • Install Python 3 Link
  • Install pylauncher Link
  • Install Heroku Toolbelt Link
  • Install and configure git Link

Open PowerShell as Administrator and execute Set-ExecutionPolicy Unrestricted answer with yes. Close Powershell. (Necessary for virtualenv)

Open PowerShell with normal limited rights.

Login into Heroku

heroku

Install virtualenv

pip install virtualenv

Install actual Django version

pip install django

1. Let's start

Navigate in the console to the folder where you want to have your Django project. Then create your project and your app.

django-admin startproject --template=https://github.com/WoHinDu/django-heroku-skeleton/archive/master.zip  --name Procfile,requirements.txt myproject
cd myproject
python manage.py startapp myapp
  • Open myproject\settings\base.py in your editor and add 'myapp.apps.MyappConfig', in the first line from INSTALLED_APPS. Note: You have to replace myapp 2x times.
  • Open myproject\settings\prod.py in your editor and replace myapp in LOGGING
  • Open myproject\settings\dev.py in your editor and replace myapp in LOGGING

Remove unnecessary stuff

rm readme.md

Create folder for static assets and templates

mkdir myapp\templates
mkdir myapp\static

Create a virtualenv called "venv"

virtualenv venv

Activate virtualenv

For Windows

.\venv\Scripts\activate

For Linux

source venv/bin/activate

To deactivate it later just type:

deactivate

Install required stuff

pip install -r myproject/reqs/dev.txt

2. Run your site

Migrate database

python manage.py migrate

Spin up the development server

python manage.py runserver

Open it in your web browser and enjoy it :)

3. Deploy to Heroku

Create empty git repo

git init

Create Heroku app

heroku create myproject --region eu

Create new GitHub repo at github.com. Then connect it with your new local git repo.

git remote add github [email protected]:githubname/githubrepo.git

Open with git config -e the configuration file from your local git repo and add at the end the following:

[remote "origin"]
	pushurl = [email protected]:githubname/githubrepo.git
	pushurl = https://git.heroku.com/herokuappname.git

You are now able to push with just one command your stuff to GitHub and Heroku.

Open myproject\settings\prod.py and copy your Heroku-app link in ALLOWED_HOSTS = ['.myapplink']. The leading dot is important! (Without https://)

Set environment variables in Heroku

heroku config:add SECRET_KEY=yoursecretkey
heroku config:add DJANGO_SETTINGS_MODULE=myproject.settings.prod

Create an account at sentry.io. Create an organisation and project. Then add your Sentry DNS code as an environment variable.

heroku config:add SENTRY_DSN=privatesentrydsn

Open temlates/500.html and replace publicsentrydsn with your public DSN from Sentry.

Note: Sentry is also available as a Heroku Addon, but unfortunately no longer as a free version.

Add Heroku modules. I choose for every module the free plan, but this can change from time to time. Please check it twice at Heroku.

Deploy Postgres. An amazing database. For more info see Postgres

heroku addons:create heroku-postgresql:hobby-dev

Deploy Papertrail. Allows you to view the logs from your app/Heroku. For more info see Papertrail

heroku addons:create papertrail:choklad	

Deploy Sendgrid. It allows you to send emails. For more info see Sendgrid

heroku addons:create sendgrid:starter

Deploy Librato. It monitors everything on Heroku for you. For more info see Librato

heroku addons:create librato:development

Add anything to git, commit and push it.

git add -A
git commit -m "Initial commit"
git push origin master

Now go to https://dashboard.heroku.com/apps/herokuappname/deploy/github and connect your GitHub repo with Heroku.

Migrate database

heroku run python manage.py migrate

Create a superuser for your project

heroku run python manage.py createsuperuser

Finished! Enjoy your new Heroku site. If you have any remarks, improvements or anything else, I'm happy about every pull request/opened issue!

heroku open

What else?

Now you have a running Django instance on Heroku. That means you can start developing your project. If you are satisfied with django-heroku-template, you can now stop configuring and start coding. If not, here a few ideas, who are maybe helpful for you:

Credits

I borrowed a few ideas from guys who are a way more familiar with Python and Django than I am. Thanks to:

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].