Pycharm is a Python business integration development tool, I feel that Python development is still very useful, Django is a popular Python web open source framework, this article is to use Pycharm+django to develop a Python Web project, Start directly below
1. Install Pytcharm and Django, there is nothing to say about the installation, in the Windows environment with the installation of general software is no big difference, the main point to note is that after the installation of Django need to set the PATH environment variable, Make sure you can use Django in any directory.
2. All programming languages do not seem professional from Hello World (joke), so let's start with HelloWorld.
2.1. In a DOS environment, go to the directory where you want to put the project, create the project with django-admin.py, for example, I want to create a Hello World project under D:\, then I enter into the DOS environment d:\ Under Execute the following command: django-admin.py startproject HelloWorld such as:
After successful execution, a HelloWorld folder is generated under D:\
2.2. Open the project with Pycharm
File-->open--> Select D:\helloworld
So we can open up the HelloWorld project.
2.3. Run the project. Actually, it's ready to run.
Once saved, run directly, this project can be run up!
2.4. Next we'll create the first app. Execute DOS command in the project directory: django-admin.py Startapp SayHello, a SayHello app is created in the project's folder.
At the same time we can also see this app in Pycharm, we can write our code in the views.py file under the SayHello folder: Add the following code:
DateTimehttpresponseSayHello (Request): ' Hello world! ' Current_time = Datetime.datetime.now () % (S, current_time) HttpResponse (HTML)
Then modify the urls.py file in the project folder, add the URL (R ' ^sayhello/', SayHello), map to Urlpatterns, then restart our project, enter HTTP +//in the browser 127.0.0.1:8000/syahello will see our results.
At this point we use the Pycharm+django development environment has been set up, we can be a skill!
Developing Web projects with Pycharm+django