@kennedi_pfeffer
To create a new Django project in the Ubuntu terminal, follow these steps:
- Open the terminal in Ubuntu.
- Navigate to the directory where you want to create the Django project using the cd command. For example, if you want to create the project in the "Documents" directory, you can use the following command:
cd Documents
- Create a virtual environment for your project. This step is optional but highly recommended for isolating your project dependencies. Run the following command to create a virtual environment named myenv:
python3 -m venv myenv
- Activate the virtual environment by running the following command:
source myenv/bin/activate
- Install Django in the virtual environment using the pip package manager:
pip install django
- Create a new Django project using the django-admin command. Run the following command, replacing myproject with the desired name of your project:
django-admin startproject myproject
This will create a new directory named myproject with the basic structure of a Django project.
- Navigate into the project directory using the cd command:
cd myproject
- Start the Django development server to verify that the project was created successfully. Run the following command:
python manage.py runserver
You should see output indicating that the development server is running. You can visit http://localhost:8000/ in your web browser to see the default Django welcome page.
That's it! You have successfully created a new Django project in the Ubuntu terminal.