Git Product home page Git Product logo

python_system's Introduction

Python Project

Cero y Uno Development and <<hidalgo.lab>>

Description

Using the knowledge of the python training create a project.

This project is based on a diagram made in class and my choice was a Shop system (POS) and if there is time to continue to start on making the start of administrations modules trying to throw high to get a close start on a ERP.

The shop will be base on this module at first glance and it will be modified:

Diagram of project

Models

  • Users
  • Products
  • Orders
  • Cart
  • CartItems
  • Catgeories
  • OrderItems
  • TODO: Define next models to be used

Models Diagram

Django Setup

Setting Up Containers for Django Project

  1. Build DB container: >docker-compose build db
  2. Bring DB container up: >docker-compose up db
    1. Set DB container to run on background: >docker-compose up -d db
  3. Build MIGRATIONS container: >docker-compose build migration
  4. Build WEB container: >docker-compose build web
  5. Create a Django Project: >docker-compose run web django-admin startproject my_web
  6. Setup DB connection on settings.py file
  7. Run MIGRATIONS container to create db >docker-compose up migration
  8. Run Web container to check if settings and db are working: >docker-compose up web
  9. Create a Super User for Admin: >docker-compose run web python manage.py createsuperuser

Helpfull Commands

  1. Create migrations for a specific app: >docker-compose run migration python manage.py makemigrations <APP_NAME>

Python Shop Setup

  1. Build Docker Image: >docker-compose build

  2. Run Dokcer DB First to avoid problems with Django Web app running first: >docker-compose up -d db

  3. Run Docker Migrations if they exist: >docker-compose build migration

  4. Run Docker Web app: >docker-compose up -d web

  5. Otherwise you could just run: >docker-compose up or >docker-compose up -d

  6. Change Settings file on the main project:

    TEMPLATE_DIR = os.path.join(BASE_DIR,'templates')
    
  7. Edit ALLOWED_HOSTS, DATABASES and TEMPLATES like the next code:

    ALLOWED_HOSTS = [
        '*'
    ]
    TEMPLATES = [
        {
            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            'DIRS': [TEMPLATE_DIR,],
            'APP_DIRS': True,
            'OPTIONS': {
                'context_processors': [
                    'django.template.context_processors.debug',
                    'django.template.context_processors.request',
                    'django.contrib.auth.context_processors.auth',
                    'django.contrib.messages.context_processors.messages',
                ],
            },
        },
    ]
    
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.postgresql',
            'NAME': 'postgres',
            'USER': 'postgres',
            'PASSWORD': 'db_password',
            'HOST': 'db', 
            'PORT': 5432,
        }
    } 
    
  8. Next Server should be running on local on port 8000:

    0.0.0.0:8000
    127.0.0.1:8000
    localhost:8000
    

Version

0.2

Credits

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.