Skip to content

Instantly share code, notes, and snippets.

@K-Jay9
Last active March 20, 2021 13:32
Show Gist options
  • Select an option

  • Save K-Jay9/36e69beeaf9bc682d223e8555a7419e7 to your computer and use it in GitHub Desktop.

Select an option

Save K-Jay9/36e69beeaf9bc682d223e8555a7419e7 to your computer and use it in GitHub Desktop.

Revisions

  1. K-Jay9 revised this gist Mar 20, 2021. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions flask_heroku.md
    Original file line number Diff line number Diff line change
    @@ -15,9 +15,9 @@ Install the required packages for creation of the app and the deployment using H
    $ pipenv install flask, autoenv, gunicorn
    ```
    Create a file called Procfile and add the following line

    ```
    web: gunicorn app:app

    ```

    Create a Heroku app using the Heroku CLI
    ```
    @@ -66,11 +66,11 @@ Create an env file using
    $ touch .env
    ```
    Then add the following lines

    ```
    pipenv shell
    export APP_SETTINGS="config.DevelopmentConfig"

    ```

    We set the Heroku environment variable by running
    ```
  2. K-Jay9 revised this gist Mar 20, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions flask_heroku.md
    Original file line number Diff line number Diff line change
    @@ -68,6 +68,7 @@ $ touch .env
    Then add the following lines

    pipenv shell

    export APP_SETTINGS="config.DevelopmentConfig"


  3. K-Jay9 revised this gist Mar 20, 2021. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion flask_heroku.md
    Original file line number Diff line number Diff line change
    @@ -72,7 +72,8 @@ export APP_SETTINGS="config.DevelopmentConfig"


    We set the Heroku environment variable by running

    ```
    $ heroku config:set APP_SETTINGS=config.StagingConfig --remote stage
    ```

    You can also go to Heroku deploy settings and set Autodeploy everytime the master branch or the github branch is updated
  4. K-Jay9 revised this gist Mar 20, 2021. 1 changed file with 15 additions and 13 deletions.
    28 changes: 15 additions & 13 deletions flask_heroku.md
    Original file line number Diff line number Diff line change
    @@ -1,35 +1,37 @@
    ## Project setup

    Initialise your git repo in the working directory with

    ```
    $ git init
    Initialise your pipenv environment by running
    ```

    Initialise your pipenv environment by running
    ```
    $ pipenv shell

    ```
    Install the required packages for creation of the app and the deployment using Heroku

    ```
    $ pipenv install flask, autoenv, gunicorn

    ```
    Create a file called Procfile and add the following line

    web: gunicorn app:app


    Create a Heroku app using the Heroku CLI

    ```
    $ heroku login
    $ heroku create karomoweb-stage

    ```
    Add the heroku remote to your git

    ```
    $ git remote add stage [email protected]:karomoweb-stage.git

    ```
    You can either connect Github to your Heroku app or using Heroku's remote to update your app

    Create a config.py file and add the following code

    ```python
    import os
    basedir = os.path.abspath(os.path.dirname(__file__))

    @@ -58,11 +60,11 @@ class DevelopmentConfig(Config):
    class TestingConfig(Config):
    TESTING = True


    ```
    Create an env file using

    ```
    $ touch .env

    ```
    Then add the following lines

    pipenv shell
  5. K-Jay9 renamed this gist Mar 20, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. K-Jay9 revised this gist Mar 20, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions flask_heroku
    Original file line number Diff line number Diff line change
    @@ -73,3 +73,4 @@ We set the Heroku environment variable by running

    $ heroku config:set APP_SETTINGS=config.StagingConfig --remote stage

    You can also go to Heroku deploy settings and set Autodeploy everytime the master branch or the github branch is updated
  7. K-Jay9 revised this gist Mar 20, 2021. 1 changed file with 73 additions and 3 deletions.
    76 changes: 73 additions & 3 deletions flask_heroku
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,75 @@
    ## Project setup

    Initialise your git repo in the working directory with
    ```git
    git init
    ```

    $ git init

    Initialise your pipenv environment by running

    $ pipenv shell

    Install the required packages for creation of the app and the deployment using Heroku

    $ pipenv install flask, autoenv, gunicorn

    Create a file called Procfile and add the following line

    web: gunicorn app:app


    Create a Heroku app using the Heroku CLI

    $ heroku login
    $ heroku create karomoweb-stage

    Add the heroku remote to your git

    $ git remote add stage [email protected]:karomoweb-stage.git

    You can either connect Github to your Heroku app or using Heroku's remote to update your app

    Create a config.py file and add the following code

    import os
    basedir = os.path.abspath(os.path.dirname(__file__))


    class Config(object):
    DEBUG = False
    TESTING = False
    CSRF_ENABLED = True
    SECRET_KEY = 'this-really-needs-to-be-changed'


    class ProductionConfig(Config):
    DEBUG = False


    class StagingConfig(Config):
    DEVELOPMENT = True
    DEBUG = True


    class DevelopmentConfig(Config):
    DEVELOPMENT = True
    DEBUG = True


    class TestingConfig(Config):
    TESTING = True


    Create an env file using

    $ touch .env

    Then add the following lines

    pipenv shell
    export APP_SETTINGS="config.DevelopmentConfig"


    We set the Heroku environment variable by running

    $ heroku config:set APP_SETTINGS=config.StagingConfig --remote stage

  8. K-Jay9 created this gist Mar 20, 2021.
    5 changes: 5 additions & 0 deletions flask_heroku
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    ## Project setup
    Initialise your git repo in the working directory with
    ```git
    git init
    ```