Conteúdo do Curso
Django: Build Your First Website
Django: Build Your First Website
Start Project
Terminal
The terminal in PyCharm is an integrated terminal that allows developers to execute commands, run scripts, manage dependencies, and interact with version control directly within the IDE. It provides a convenient way to work with the command line without leaving the development environment.
In this chapter, we will use the terminal to install Django and run a test local server.
Follow the instructions to create a Django project:
Install Django
Step 1. Open PyCharm and create new project;
Step 2. Install Django using the following command:
If the command above doesn't work, try inputting this pip3 install django
.
Django Project
Step 3. Initialize a new Django project using the following command:
- The command
django-admin startproject notes
is used to create a new Django project with the namenotes
; - I named my project
notes
, you can name your project whatever you like.
Development Server
Step 4. Running test server:
- Go to app folder:
- Run development server:
If the command above doesn't work, try inputting this python3 manage.py runserver
.
This command starts the development server, allowing you to test and preview your Django application locally.
After running this command, you should see output indicating that the server is running. By default, the server will be available at http://127.0.0.1:8000/
in your web browser.
To stop the local server:
Ctrl + C
in the terminal: If you started the server from the terminal, simply press theCtrl + C
key combination. This will stop the server;- Closing the terminal: If the server is running in the terminal, simply close the terminal window or command prompt where it is running. This will also stop the server.
Obrigado pelo seu feedback!