Django Installation, configuration process
Preparatory process:
Install Python and Pip (for the current version of Python, the PIP installation will be installed during the installation)
Django Installation process:
STEP1: Install Django with PIP.
Execute the following command at the command line:
- Pip Install Django
STEP2: Go to the directory where you want to create a new Django project
Execute the following command to create a project:
- Django-admin. PY startproject mysite
Where MySite represents the project name.
STEP3: Go inside the outer mysite folder, execute the following command and test if the service starts properly:
- Python mange. PY runserver 0.0. 0.0:8000
This service is primarily used for testing in the development process, not for formal operations.
You can now access the site through Ip:8000/.
The development server automatically overloads Python code as needed without having to restart the server specifically.
However, for operations such as adding files, you will need to restart the server manually.
At this point, we use the browser to access the localhost:8000 locally, if you can successfully see the following page, it means that the installation is successful:
STEP4: Configuring settings.py Files
In general, we need to modify the following configuration:
- ...
- Time_zone = ' Asia/shanghai '
- ...
- DATABASES = {
- ' Default ': {
- ' ENGINE ': ' django.db.backends.oracle ',
- ' NAME ': ' ORCL ', #数据库名称
- ' USER ': ' Hello ', #用户名
- ' PASSWORD ': ' Hello ', #密码
- ' HOST ': ' 127.0.0.1 ', #HOST
- ' PORT ': ' 1521 ', #端口
- }
- }
Where Time_zone is in order to set the time zone to Beijing, databases is configuring the Oracle database.
STEP5: After the configuration is complete, perform the following command to initialize the database
- Python manage. Py Migrate
After successful execution, the database initialization is complete and the entire installation configuration process is completed.
May be an error ora-01031:insufficient privileges
ORA-01031 Insufficient Permissions
Create a user with Oracle and Grant DBA authority
1) Creating User: Create users hello identified by Hello;
2) Grant DBA authority to grant CONNECT,RESOURCE,DBA to Hello;
Configuring the Django Connection Orcale database