[PYTHON] Start Django in a virtual environment with Pipenv

Introduction

Start Django in a virtual environment with Pipenv.

Placing Django on a virtual environment using Pipenv will always result in the same results for builds with Docker and team development, making development smoother. We consider it a best practice for development with multiple people and Docker.

This article is part of the Build a Django app on Docker and deploy it to AWS Fargate project.

Installation of pipenv

Install pipenv using pip.

$ pip install pipenv

Install Django on a virtual environment

After installing pipenv, create a hello directory on your desktop and change to the hello directory.

$ cd ~/Desktop
$ mkdir hello && cd hello

Install Django on your virtual environment using the Pipenv command.

$ pipenv install django==2.2.3

After execution, Pipfile and Pipfile.lock files will be created. The Pipfile records the name and version of the library to install. Pipfile.lock records information about the libraries that were actually installed.

$ ls
Pipfile		Pipfile.lock

Enter the virtual environment and run the startproject command to create a new Django project. Don't forget the period.

$ pipenv shell
(hello)$ django-admin startproject hello_project .

Perform migration to initialize the database and start the Django development server.

(hello)$ python manage.py migrate
(hello)$ python manage.py runserver

If you access http://127.0.0.1:8000/ with your browser, you'll see the Django welcome page. This confirms that Django is running in the virtual environment.

スクリーンショット 2020-01-24 21.30.47.png

Recommended Posts

Start Django in a virtual environment with Pipenv
Install Django in a pipenv virtual environment
Try running python in a Django environment created with pipenv
Create a virtual environment with conda in Python
Build a Django environment with Vagrant in 5 minutes
Work in a virtual environment with Python virtualenv.
Build a Django environment for Win10 (with virtual space)
Create a virtual environment with Python!
Building a virtual environment with Python 3
Create a Django project and application in a Python virtual environment and start the server
A story when a directory is buggy with the django-admin start project command in a virtual environment using Pipenv
[Django3] Display a web page in Django3 + WSL + Python virtual environment
[Python] Create a virtual environment with Anaconda
Create a virtual environment with Python_Mac version
Build a python virtual environment with pyenv
Creating a virtual environment in an Anaconda environment
I started Node.js in a virtual environment
Debug settings in virtual environment when using Pipenv with VS Code
Ubuntu18.04.05 Creating a python virtual environment in LTS
[Python] Build a Django development environment with Docker
python virtual environment Pipenv
[Memo] Build a virtual environment with Pyenv + anaconda
Build a virtual environment with pyenv and venv
Build a Django development environment with Doker Toolbox
virtual environment in python
Flow of creating a virtual environment with Anaconda
Configure a module with multiple files in Django
Quickly build a Python Django environment with IntelliJ
Start a Django project
Virtual environment with Python 3.6
Start today with Django
Build a python virtual environment with virtualenv and virtualenvwrapper
Create a virtual environment with Anaconda installed via Pyenv
code-server Online environment (2) Create a virtual network with Boto3
Build a Python virtual environment using venv (Django + MySQL ①)
Build a python virtual environment with virtualenv and virtualenvwrapper
Notes on creating a virtual environment with Anaconda Navigator
Build a development environment with Poetry Django Docker Pycharm
Create a django environment with docker-compose (MariaDB + Nginx + uWSGI)
Minimal website environment with django
Collaborate in a remote environment
Create a homepage with django
Building a Python virtual environment
(Note) Django in Vagrant environment
Switch virtual environment with jupyter
Building a Python virtual environment
[Django] Manage settings like writing in settings.py with a model
Build a Django development environment with Docker! (Docker-compose / Django / postgreSQL / nginx)
Build Azure Pipelies with Azure DevOps in a Linux self-hosted environment
[Memo] Build a development environment for Django + Nuxt.js with Docker
I want to start a jupyter environment with one command
Reflect the virtual environment created with Miniconda in Jupyter notebook
A note on how to load a virtual environment in PyCharm
[Django] Build a Django container (Docker) development environment quickly with PyCharm
How to develop in a virtual environment of Python [Memo]
Until I return something with a line bot in Django!
Build a comfortable development environment with VSCode x Remote Development x Pipenv
I want to use a virtual environment with jupyter notebook!
I just built a virtual environment with AWS lambda layer
Create a Todo app with Django ① Build an environment with Docker
Building a virtual environment with pyenv-virtualenv/Python (installation, environment settings, packages) Mac environment