Skip to content
Snippets Groups Projects
Commit 2c714593 authored by Tobiasz Kędzierski's avatar Tobiasz Kędzierski Committed by James Curtin
Browse files

fixup! Add heroku deployment feature

parent 6264b223
No related branches found
No related tags found
No related merge requests found
......@@ -8,5 +8,5 @@
"use_pipenv": ["no", "yes"],
"python_version": ["3.7", "3.6"],
"node_version": ["12", "10", "8"],
"deployment_on_heroku": ["no", "yes"]
"use_heroku": ["no", "yes"]
}
......@@ -10,6 +10,7 @@ import sys
def clean_extra_package_management_files():
"""Removes either requirements files and folder or the Pipfile."""
use_pipenv = "{{cookiecutter.use_pipenv}}"
use_heroku = "{{cookiecutter.use_heroku}}"
to_delete = []
if use_pipenv == "yes":
......@@ -17,6 +18,9 @@ def clean_extra_package_management_files():
else:
to_delete.append("Pipfile")
if use_heroku == "no":
to_delete = to_delete + ["Procfile", "app.json"]
try:
for file_or_dir in to_delete:
if os.path.isfile(file_or_dir):
......
......@@ -12,8 +12,8 @@ click = ">=5.0"
# Database
Flask-SQLAlchemy = "==2.4.1"
SQLAlchemy = "==1.3.9"
{%- if cookiecutter.deployment_on_heroku == "yes" %}
psycopg2 = "==2.8.3"
{%- if cookiecutter.use_heroku == "yes" %}
psycopg2-binary = "==2.8.3"
{%- endif %}
# Migrations
......
......@@ -136,8 +136,8 @@ in your ``settings.py``::
SEND_FILE_MAX_AGE_DEFAULT = 31556926 # one year
{%- if cookiecutter.use_heroku == "yes" %}
{%- if cookiecutter.deployment_on_heroku == "yes" %}
Deployment on Heroku
--------------------
......@@ -174,13 +174,15 @@ If you want deploy by using Heroku CLI:
heroku buildpacks:add --index=1 heroku/nodejs
heroku buildpacks:add --index=1 heroku/python
* add Postgres database addon (it also sets `DATABASE_URL` environmental variable to created database)::
* add database addon which sets Postgres in version 11 in free `hobby-dev` plan (https://elements.heroku.com/addons/heroku-postgresql#hobby-dev) (it also sets `DATABASE_URL` environmental variable to created database)::
heroku addons:create heroku-postgresql:hobby-dev
heroku addons:create heroku-postgresql:hobby-dev --version=11
* set environmental variables (change secret key)::
* set environmental variables: change secret key.
`DATABASE_URL` environmental variable is set by database addon in previous step.
Please check `.env.example` to get overview which environmental variables are used in project.::
heroku config:set SECRET_KEY=<secret-key>
heroku config:set SECRET_KEY=not-so-secret
heroku config:set FLASK_APP=autoapp.py
* deploy on Heroku::
......
......@@ -21,7 +21,7 @@
],
"addons": [
{
"plan": "heroku-postgresql",
"plan": "heroku-postgresql:hobby-dev",
"options": {
"version": "11"
}
......
......@@ -8,8 +8,8 @@ click>=7.0
# Database
Flask-SQLAlchemy==2.4.1
SQLAlchemy==1.3.9
{%- if cookiecutter.deployment_on_heroku == "yes" %}
psycopg2==2.8.3
{%- if cookiecutter.use_heroku == "yes" %}
psycopg2-binary==2.8.3
{%- endif %}
# Migrations
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment