By mmmrev
How do you setup a Python 3.7 and pipenv production environment on Ubuntu 18.04?
My development environment uses Python 3.7, Flask, and Pipenv. All the tutorials I found only show how to use python3.7 -m venv, pip, and the likes. For example,
Google doesn’t seem to show results on using pipenv for production. Any idea?
FYI: I’m using Ubuntu 18.04, Nginx, Python 3.7, Pipenv, Flask, PostgreSQL.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Heya,
I’d be happy to help you set up a Python 3.7 and Pipenv production environment on Ubuntu.
To set up your environment, follow these steps:
Install Python 3.7: First, make sure you have Python 3.7 installed on your Ubuntu 18.04 system. If you don’t, you can follow this tutorial to install it: How to Install Python 3 and Set Up a Programming Environment on Ubuntu 18.04.
Install Pipenv: Next, install Pipenv using the following command:
- pip install --user pipenv
Activate Pipenv environment: Navigate to your project directory and initiate your Pipenv environment by running:
- pipenv install
Install dependencies: Install your required packages inside the Pipenv by either specifying them in your Pipfile or by running the following command for each dependency:
- pipenv install package_name
Configure Nginx: Since you’re using Nginx, you can follow this tutorial to configure it for your Flask application: How To Serve Flask Applications with uWSGI and Nginx on Ubuntu 18.04.
Configure PostgreSQL: Make sure you have your PostgreSQL database configured correctly. If you need help, check out this tutorial: How to Set Up a New Django Project with PostgreSQL Using Pipenv (The PostgreSQL setup part).
Check out the full Pipenv documentation for more information on using Pipenv in your projects.
Hope that this helps!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.