- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to deploy python modules on Heroku?
Assuming you have set up Python 3.6, Pipenv and heroku CLI installed locally and are logged in on Heroku from the CLI using the steps mentioned here: https://devcenter.heroku.com/articles/getting-started-with-python#set-up.
Your application needs to have a git repository to be deployed to heroku. You need to cd in the directory where the root of your git repo code resides. Now you need to create a heroku application using:
$ heroku create Creating lit-bastion-5032 in organization heroku... done, stack is cedar-14
http://lit-bastion-5032.herokuapp.com/ | https://git.heroku.com/lit-bastion-5032.git
Git remote heroku added
When you create an app, a git remote (called heroku) is also created and associated with your local git repository. Heroku generates a random name (in this case lit-bastion-5032) for your app, or you can pass a parameter to specify your own app name.
Now that a remote has been added, you can push your code to heroku using:
$ git push heroku master Counting objects: 232, done. Delta compression using up to 4 threads. Compressing objects: 100% (217/217), done. Writing objects: 100% (232/232), 29.64 KiB | 0 bytes/s, done. Total 232 (delta 118), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: -----> Python app detected remote: -----> Installing python-3.6.0 remote: -----> Installing requirements with latest pipenv... remote: Installing dependencies from Pipfile.lock... remote: $ python manage.py collectstatic --noinput remote: 58 static files copied to '/app/gettingstarted/staticfiles', 58 post-processed. remote: remote: -----> Discovering process types remote: Procfile declares types -> web remote: remote: -----> Compressing... remote: Done: 39.3M remote: -----> Launching... remote: Released v4 remote: http://lit-bastion-5032.herokuapp.com/ deployed to Heroku remote: remote: Verifying deploy... done. To git@heroku.com:lit-bastion-5032.git * [new branch] master -> master Note that you need to specify your requirements(third party modules you are importing) with their version numbers(or without if you need latest one) in the requirements.txt. For example, Flask==0.8 Jinja2==2.6 Werkzeug==0.8.3 certifi==0.0.8 chardet==1.0.1
You can read more about this on the heroku python docs: https://devcenter.heroku.com/articles/python-pip
- Related Articles
- How to install libxml2 with python modules on Mac?
- How to deploy windows deployment services on server 2012 r2
- How to use remote python modules?
- How much does it cost to deploy applications on the Google Play Store?
- How to check version of python modules?
- How to install Python modules in Cygwin?
- How do Python modules work?
- How to install python modules without root access?
- How to use Python modules over Paramiko (SSH)?
- How to deploy machine learning model using Django?
- How to use multiple modules with Python import Statement?
- How to encapsulate Python modules in a single file?
- How to install python modules and their dependencies easily?
- How to Install two python modules with same name?
- How to disable logging from imported modules in Python?
