Report this

What is the reason for this report?

How to SETUP pipenv ON ubuntu 18.04 FOR python flask apps?

Posted on August 14, 2019

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!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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:

  1. 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.

  2. Install Pipenv: Next, install Pipenv using the following command:

    1. pip install --user pipenv
  3. Activate Pipenv environment: Navigate to your project directory and initiate your Pipenv environment by running:

    1. pipenv install
  4. 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:

    1. pipenv install package_name
  5. 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.

  6. 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!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.