Skip to content

Instantly share code, notes, and snippets.

@ashx3s
Last active December 12, 2021 02:59
Show Gist options
  • Select an option

  • Save ashx3s/806018ca65c8e03ef7d4334d6336f7b8 to your computer and use it in GitHub Desktop.

Select an option

Save ashx3s/806018ca65c8e03ef7d4334d6336f7b8 to your computer and use it in GitHub Desktop.
User Testing Heroku App

Create a heroku app for user testing (Python)

These are steps to follow for setting up a test website for user testing. Create a heroku app from your server side rendered website.

This is useful for when you have a part of a website that is going through a large overhaul.

Set up Heroku

  • Create a heroku account
  • Install the heroku cli
  • Login to heroku with the cli
  • now you can create your heroku app
  • heroku commands to review

Create heroku app

  • heroku create
    • This will set up heroku to accept code
    • You can create a specific name instead of using the auto generated names
      • ex: heroku create app-name-thing
  • get push heroku main
    • this will put the code into the project
  • heroku ps:scale web=1
    • this will check that something's live
  • heroku open
    • open up the running app

Check info about your app

  • heroku logs
    • check all logs
    • add --tail for just the last few logs
  • Procfile
    • the procfile is kind of like the scripts in package.json in a npm project

Run the App Locally

  • After installing the app's dependencies locally, you can the app by running the Procfile
    • install python dependencies with pip install -r requirements.txt
    • check installed files with pip list
  • Do any other setup that you need to do to run your python app
    • ie django you might need to run python manage.py collectstatic to use local assets
  • then run the local environment with
    • heroku local web
    • or on windows run heroku local web -f Procfile.windows
    • this will set up a local heroku web server on localhost:5000

Push local changes

  • Local changes need to be pushed to heroku
    • this can be things like installing new packages
    • Add your packages and made edits then run heroku local to test that they work
  • add and commit with git
  • then run git push heroku main
  • verify that the site is live with heroku open

Heroku Config Vars

You can store encryption keys and other external resource addresses in config vars

  • set config vars with the following syntax
    • example: heroku config:set TIMES=1
  • then view the config vars with
    • heroku config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment