Skip to content

Swapno963/Linux

Repository files navigation

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:

python3 --version

1. Install pip3

pip3 is the package manager for Python, allowing you to easily install and manage Python libraries.

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.

sudo apt update
sudo apt install python3-venv

3. Create and Activate a Virtual Environment and Activate it

  • Create the virtual environment:
python3 -m venv myenv && source myenv/bin/activate

Do Everything at once

pip3 install django && django-admin startproject myproject . && python manage.py startapp myapp && python manage.py migrate && python manage.py createsuperuser --username ad --email admin@example.com && pip3 freeze > requirements.txt && python manage.py runserver

4. Install Django,djangorestframework

Once inside the virtual environment, install Django:

pip3 install django djangorestframework

5. Deactivate the Virtual Environment

To exit the virtual environment, simply run:

deactivate

6. Django Project Commands

  • Create a New Django Project:
django-admin startproject myproject
  • Create a New Django App:
python manage.py startapp myapp
  • Make Migrations: This command creates migration files for any changes made to the models.
python manage.py makemigrations
  • Apply Migrations: This command applies the migration files to the database.
python manage.py migrate
  • Create a Superuser: Set up an admin account to access Django’s admin interface.
python manage.py createsuperuser --username ad --email admin@example.com 
  • Run the Development Server: Start the Django development server to view your project in the browser.
python manage.py runserver

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published