reubence / heroku-script-scraping

A repo for my scraping project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Contributors Forks Stargazers Issues Last Commit
LinkedIn


Logo

HEROKU Script-Deployment Template

An awesome template to jumpstart your python script hosting projects on Heroku!

View Demo · Report Bug · Request Feature

Table of Contents

About The Template

Logo

There are many great heroku templates available on GitHub, however, I didn't find one that was configured to host and run python scripts quickly on heroku (on a worker dyno) so I created this enhanced one.

Here's why:

  • Your time should be focused on creating something amazing. A project that solves a problem and helps others.
  • You shouldn't be doing the same tasks over and over like preparing files for deployment on heroku from scratch.
  • You should reserve the DRY principles to the rest of your life 😄

Of course, no one template will serve all projects since your needs may be different. So I'll be adding more in the near future. You may also suggest changes by forking this repo and creating a pull request or opening an issue.

Built With

Getting Started

First things first, this template is configured to host a worker dyno which allows you to host python scripts on heroku. You can modify this template to run a flask frontend by editing the procfile to web: gunicorn app:server (Renamed server.py file to app.py). Many templates and/or documentations are available online for the same. I'll be going over the steps to configure a worker dyno for hosting scripts on heroku only for the purposes of this guide.

Prerequisites

Before we begin, you need a couple of things installed...

  • Download and Install Heroku CLI and type the following to log into your heroku account heroku login .
  • Download and Install git

After Downloading git, you can run these commands to set your username and password.

git config --global user.email "your_email_address@example.com" 
git config user.password "your password" 

Installation

  1. Scroll to the top of this page, and click on the Use This Template button to create your own repo using this template.
  2. Connect the remote repo to your local machine using git remote add origin <remote-repo-url>

Usage

  1. Edit the server.py file in the repo to add your own python scripts.
  2. If you've used any external packages you need to mention them in the requirements.txt file.
  3. If you've changed the name of the file in Step 1 then you need to edit it in the Procfile as well. worker: python file-name.py
  4. To deploy to heroku, follow the usual steps for any heroku deployment.
git add.
git commit -m"Heroku push"
heroku create
git push heroku master
  1. Now, once deployed, we need to give a command to heroku to start the worker process. (Your script won't start executing unless you run this line in terminal)
heroku ps:scale worker=1

Additionally, you can also tell heroku to stop executing once you have got your output by running the command heroku ps:scale worker=0

Contributing

Contributions are what make the open source community such an amazing place to be, learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Contact

Reuben Rapose - @reubence - reuben.rapose@gmail.com

Project Link: https://github.com/reubence/Heroku-Script-Deployment-Template

Acknowledgements

About

A repo for my scraping project


Languages

Language:Python 100.0%