DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,503 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for Running python django site
ILshat Khamitov
ILshat Khamitov

Posted on

Running python django site

Installing python and all the required libraries

sudo apt-get update
sudo apt-get install postgresql postgresql-contrib -y
sudo apt-get install python-pip python-dev build-essential -y
sudo apt-get install libpq-dev -y
sudo pip install --upgrade pip
sudo pip install --upgrade virtualenv
Enter fullscreen mode Exit fullscreen mode

Creating a project

mkdir mysite && cd mysite
virtualenv venv
source venv / bin / activate
pip install django-toolbelt
django-admin.py startproject mysite.
echo "web: gunicorn mysite.wsgi"> Procfile
pip freeze> requirements.txt
echo "venv"> .gitignore
git init
git add.
git commit -m "First Commit for Mysite"
Enter fullscreen mode Exit fullscreen mode

Launch site

virtualenv venv
source venv / bin / activate
export $ (cat .env)
pip install -r requirements.txt
python manage.py collectstatic --noinput
gunicorn project.wsgi -b 0.0.0.0:5000
Enter fullscreen mode Exit fullscreen mode

Working with the migrations in Django

python manage.py migrate
python manage.py makemigrations
python manage.py makemigrations --empty yourappname
Enter fullscreen mode Exit fullscreen mode

Working with a list of required packages

pip freeze> requirements.txt
pip install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode

Creating an application

django-admin.py startapp myapp app / myapp
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

DEV has this feature:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. πŸ›