How to start a new Django project using poetry?

Issue

How to start a new Django project using poetry?

With virtualenv it is simple:

virtualenv -p python3 env_name --no-site-packages
source env_name/bin/activate
pip install django
django-admin.py startproject demo
pip freeze > requirements.txt

What will be equivalent to this using Poetry?

Solution

Create a new project folder and step in:

$ mkdir djangodemo
$ cd djangodemo

Create a basic pyproject.toml with django as dependency:

$ poetry init --no-interaction --dependency django

Create venv with all dependencies needed:

$ poetry install

Init your demo-project

$ poetry run django-admin.py startproject djangodemo

Answered By – finswimmer

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published