Giter Site home page Giter Site logo

sklep's Introduction

Awesome Store

Django Quick

Commands:

# Creating project
django-admin startproject <project_name>

# Running server
./manage.py runserver

# Creating app
django-admin startapp <app_name>


# Show all commands
./manage.py

Virtual Environment commands (pipenv):

You can use any virtual env package (like virtualenv) but pipenv is the best for project like django because stores all versions of packages and dependencies with theirs hashes.

Pipfile and Pipfile.lock you should store in repository.

pip install pipenv
pipenv shell
pipenv install django==3.1

pipenv -h
pip freeze > requirements.txt

Test Coverage commands (coverage):

pipenv install coverage

coverage run --omit='*/venv/*' manage.py test

coverage report
coverage html
open ./htmlcov/index.html

Create project from template:

If you need something more powerful use: cookiecutter-django

# Creating template
mkdir project-name && cd project-name
# prepare virtual env

django-admin startproject project_name .

# open project and rename <project_name> to <{{ project_name }}> in all files

# Using template
django-admin startporject --template <path or URI> <project_name> .

# Working example
django-admin startproject --template https://github.com/pawelkonior/django_template/archive/master.zip new_latest_proj .

New functionality algorithm

  1. New django-app ( bash python manage.py startapp <app-name>)
  2. Django models (models.py)
  3. Add app to INSTALLED_APPS (settings.py)
  4. Migrations ( bash py manage.py makemigrations <app-name>, bash py manage.py migrate <app-name>)
  5. Add models to CMS (content managment system) (admin.py)
  6. Add custom date using shell (bash py manage.py shell)
  7. Django Forms
  8. Views (Logic, views.py)
  9. Django Templates (templates/<app-name>/<template-name>)
  10. Router (local urls.py -> urlspattern, global urls.py)
  11. Profit!!

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.