https://github.com/swapno963/linux
https://github.com/swapno963/linux
automationscripts docker linux
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/swapno963/linux
- Owner: Swapno963
- Created: 2024-10-29T05:21:32.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-12-22T04:42:58.000Z (5 months ago)
- Last Synced: 2025-01-30T02:22:14.148Z (4 months ago)
- Topics: automationscripts, docker, linux
- Homepage:
- Size: 38.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Project on Linux Setup Guide
This guide provides step-by-step instructions for setting up Python, pip, virtual environments, and Django on a Linux system.
## Prerequisites
Ensure **Python 3** is installed on your system. You can check this by running:
```bash
python3 --version
```## 1. Install pip3
pip3 is the package manager for Python, allowing you to easily install and manage Python libraries.
```bash
sudo apt update
sudo apt install python3-pip
pip3 --version # Verify the installation
```## 2. Install python3-venv
The python3-venv module is used to create isolated Python environments.
```bash
sudo apt update
sudo apt install python3-venv
```## 3. Create and Activate a Virtual Environment and Activate it
- Create the virtual environment:
```bash
python3 -m venv myenv && source myenv/bin/activate
```
### Do Everything at once
```bash
pip3 install django && django-admin startproject myproject . && python manage.py startapp myapp && python manage.py migrate && python manage.py createsuperuser --username ad --email [email protected] && pip3 freeze > requirements.txt && python manage.py runserver
```## 4. Install Django,djangorestframework
Once inside the virtual environment, install Django:
```bash
pip3 install django djangorestframework
```## 5. Deactivate the Virtual Environment
To exit the virtual environment, simply run:
```bash
deactivate
```## 6. Django Project Commands
- Create a New Django Project:
```bash
django-admin startproject myproject
```- Create a New Django App:
```bash
python manage.py startapp myapp
```
- Make Migrations: This command creates migration files for any changes made to the models.
```bash
python manage.py makemigrations
```
- Apply Migrations: This command applies the migration files to the database.
```bash
python manage.py migrate
```
- Create a Superuser: Set up an admin account to access Django’s admin interface.
```bash
python manage.py createsuperuser --username ad --email [email protected]
```
- Run the Development Server: Start the Django development server to view your project in the browser.
```bash
python manage.py runserver
```