Create new application use python, django

Install packages

$ sudo yum -y install python-devel
$ sudo easy_install pip
$ sudo pip install -U pip
$ sudo pip install virtualenv

$ mkdir ~/.pyenv
$ cd ~/.pyenv

$ sudo pip install virtualenvwrapper
$ vi ~/.bashrc
# Virtualenvwrapper
if [ -f /usr/bin/virtualenvwrapper.sh ]; then
    export WORKON_HOME=$HOME/.pyenv
    source /usr/bin/virtualenvwrapper.sh
fi
$ source ~/.bashrc

$ sudo su -
# vi ~/.bashrc
# Virtualenvwrapper
if [ -f /usr/bin/virtualenvwrapper.sh ]; then
    export WORKON_HOME=/home/user-name/.pyenv
    source /usr/bin/virtualenvwrapper.sh
fi
$ source ~/.bashrc

Running

$ workon
$ mkvirtualenv test01
(test01)$ cdvirtualenv
(test01)$ pwd
/home/user-name/.pyenv/test01
(test01)$ deactivate
$ workon
test01

Install django in virtualenv

$ workon test01
$ pip list
pip (7.1.2)
setuptools (18.2)
wheel (0.24.0)

$ pip install django
$ pip list
Django (1.9)
pip (7.1.2)
setuptools (18.2)
wheel (0.24.0)

$ python -V
Python 2.7.5

$ python
>>> import django
>>> django.get_version()
'1.9'

Create application

$ sudo vi /etc/sysctl.conf
net.ipv4.ip_forward=1
$ sudo sysctl -p
net.ipv4.ip_forward = 1
$ sudo firewall-cmd --permanent --zone=public --add-masquerade
$ sudo firewall-cmd --permanent --add-port=8000/tcp
$ sudo firewall-cmd --reload
# sudo su -
# sqlite3 --version
3.7.17 2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668
# cd /opt; pwd
/opt
# workon test01
# django-admin startproject test01
# cd test01; pwd
/opt/test01
# python manage.py runserver 8000


image

and more

# ls -l
40 in total
-rw-r--r--1 root root 36864 January 2 17:41 db.sqlite3
-rwxrwxr-x 1 root root 249 January 2 02:28 manage.py
drwxr-xr-x 2 root root 138 January 2 17:41 test01

# python manage.py migrate
# python manage.py createsuperuser
# python manage.py startapp cms

* I want to add more in the future

Reference

Recommended Posts

Create new application use python, django
Create a new Python numerical calculation project
Use Application Insights with Python 3 (including bottles)
Use Django from a local Python script
Python Django Tutorial (5)
Python Django Tutorial (2)
Python Django Tutorial (8)
Python Django Tutorial (6)
Python Django Tutorial (7)
Python Django Tutorial (1)
Python Django tutorial tutorial
Python Django Tutorial (3)
Python Django Tutorial (4)
[Introduction to Udemy Python3 + Application] 23. How to use tuples
Create a New Todoist Task from Python Script
Create Nginx + uWSGI + Python (Django) environment with docker
Create a new page in confluence with Python
Create a one-file hello world application with django
Until you create a new app in Django
Create a Python console application easily with Click
Use Python / Django with Windows Azure Cloud Service!
Create a Django project and application in a Python virtual environment and start the server
Django 1.11 started with Python3.6
Use thingsspeak from python
Create a Django schedule
Use config.ini in Python
[Python] [Django] How to use ChoiceField and how to add options
Python Django tutorial summary
Use fluentd from python
Use dates in Python
Create a Python module
[Python] Create multiple directories
Create SpatiaLite in Python
Use Gentelella with django
[CRUD] [Django] Create a CRUD site using the Python framework Django ~ 1 ~
Use Valgrind in Python
Use MySQL from Python
Django Python shift table
[Mac OS] Use Kivy with PyCharm! [Python application development]
Use mecab with Python3
Use LiquidTap Python Client ③
Use DynamoDB with Python
Deploy a Django application on Google App Engine (Python3)
Try Debian + Python 3.4 + django1.7 ...
[Personal notes] Python, Django
Use Python 3.8 with Anaconda
Web application made with Python3.4 + Django (Part.1 Environment construction)
[Python] format methodical use
Use python with docker
Use MySQL from Python
What's new in Python 3.5
New in Python 3.4.0 (1)-pathlib
Use LiquidTap Python Client ②
Use LESS with Django
[Introduction to Udemy Python3 + Application] 27. How to use the dictionary
[CRUD] [Django] Create a CRUD site using the Python framework Django ~ 2 ~
[Introduction to Udemy Python3 + Application] 30. How to use the set
Use BigQuery from python.
How to use Django on Google App Engine / Python
Use profiler in Python
A memo about building a Django (Python) application with Docker