DEV Community

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)