程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

2. Teach you step by step to use pycharm to run the first Django project

編輯:Python

The following steps show how to connect pycharm and the project environment in ubuntu through the VirtualBox manager!
If you have your own server, the core steps are almost the same, and even using the server steps is much simpler!(But be careful: add your server's ip address to the ALLOWED_HOSTS value in the settings.py file!)

1. Build Django:

Step 1: Create a Django project with pycharm:

1. Create a new Django project:

2. Specify the python interpreter in the virtual environment created in the remote for the Django project:

3. Configure port forwarding for ubuntu (add a port with port number 1234):

Step 2: Do some basic configuration for the newly created Django project!!!

(1) Change the upload method to ctrl+s to save the upload method:

First select Tools>Devloyment>options
then select ctrl+s to save upload method

(2) Basic parameter configuration:

Select Tools>Devloyment>Configuration


Note that the remote project storage path here isIt is spliced ​​with the root path in the previous connection

(3) Set who can access this Django project (two steps!)

The first step: the address of the client that is allowed to access, "*" means any ip address
Second step:
First:
then:

(4) Enter: 127.0.0.1:8000 in the local browser to find that Django is ok!!!

Be careful to run the project first!
Enter the project directory in ubuntu and use the project virtual environment.Enter the command:

python manage.py runserver

You can run the project!

Extension - the above is a django project created with pycharm, let's see how to use the command to create:

The following command is enough:

django-admin startproject project name

It should be noted that if it is created by command, we need to create a server according to the following steps:



The added key is

DJANGO_SETTINGS_MODULE

The added value is:

The name of this project.settings

The shape is as follows:

OK!Follow the above operation method to see the small rocket!!!

Let me introduce myself first. The editor graduated from Jiaotong University in 2013. I worked in a small company and went to big factories such as Huawei and OPPO. I joined Ali in 2018, until now.I know that most junior and intermediate java engineers want to upgrade their skills, they often need to explore their own growth or sign up to study, but for training institutions, the tuition fee is nearly 10,000 yuan, which is really stressful.Self-learning that is not systematic is very inefficient and lengthy, and it is easy to hit the ceiling and the technology stops.Therefore, I collected a "full set of learning materials for java development" for everyone. The original intention is also very simple. I hope to help friends who want to learn by themselves but don't know where to start, and at the same time reduce everyone's burden.Add the business card below to get a full set of learning materials


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved