Giter VIP home page Giter VIP logo

learn_django_basics's Introduction

Virtual Environment

Task Command
Create virtual environment python3 -m venv venv
Activate virtual environment source venv/bin/activate
Deactivate virtual environment deactivate
List installed packages pip list
Create requirements.txt file pip freeze > requirements.txt
Install packages from requirements.txt pip install -r requirements.txt
. .
. .

Django

Start Project

Task Command
Creating a new project django-admin startproject project_name
Start a server python manage.py runserver
. .
. .

Manage Project

Task Command
Create a new app python manage.py startapp appName
Consolidate static files python manage.py collectstatic

Manage Database

Task Command
Migrate the database python manage.py migrate
Make migrations python manage.py makemigrations
. .

Creating a model

  1. Create the model (class) in models.py
  2. Add the app to the settings
  3. Create a migration
  4. Migrate
  5. Add the model to the admin

Manage Users

Task Command
Create superuser python manage.py createsuperuser
. .
. .

Using psql (Postgres)

Task Command
Start the service sudo service postgresql start
Connect to postgres sudo -u postgres psql
Check user accounts \du
Create database CREATE DATABASE name;
Check port number \conninfo
Change user password \password username
Delete Database DROP DATABASE db_name
Quit psql \q
Show databases \l
. .
. .

learn_django_basics's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.