Installing python and all the required libraries
sudo apt-get updatesudo apt-get install postgresql postgresql-contrib -ysudo apt-get install python-pip python-dev build-essential -ysudo apt-get install libpq-dev -ysudo pip install --upgrade pipsudo pip install --upgrade virtualenvsudo 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 virtualenvsudo 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 mysitevirtualenv venvsource venv / bin / activatepip install django-toolbeltdjango-admin.py startproject mysite.echo "web: gunicorn mysite.wsgi"> Procfilepip freeze> requirements.txtecho "venv"> .gitignoregit initgit add.git commit -m "First Commit for Mysite"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"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 venvsource venv / bin / activateexport $ (cat .env)pip install -r requirements.txtpython manage.py collectstatic --noinputgunicorn project.wsgi -b 0.0.0.0:5000virtualenv 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:5000virtualenv 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 migratepython manage.py makemigrationspython manage.py makemigrations --empty yourappnamepython manage.py migrate python manage.py makemigrations python manage.py makemigrations --empty yourappnamepython 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.txtpip install -r requirements.txtpip freeze> requirements.txt pip install -r requirements.txtpip freeze> requirements.txt pip install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode
Creating an application
django-admin.py startapp myapp app / myappdjango-admin.py startapp myapp app / myappdjango-admin.py startapp myapp app / myapp
Enter fullscreen mode Exit fullscreen mode
© 版权声明
THE END
暂无评论内容