Giter Club home page Giter Club logo

ucrk's Introduction

UCRK

FullStack web application for a training center of excellence using React / Django for development and Nginx / Gunicorn for deployment.


Project Status

Completed โœ“


Functionality

Technologies and Frameworks

  • Python 3.11
  • Django 4.2
  • DRF 3.14
  • ReactJS 6.0
  • PostgreSQL
  • CI/CD
  • Nginx / Gunicorn

Installation

  1. Clone the repository to the local machine

    git clone https://github.com/Segfaul/ucrk.git
  2. Go to the repository directory

    cd ucrk/
  3. Create and activate a virtual environment

    python -m venv env
    source env/bin/activate
  4. Set project dependencies

    pip install -r requirements.txt
  5. Go to /backend directory and configure .env file (similar to .env-ex)

    cd backend/
    nano .env
  6. Go to /frontend directory, install depencies, build project

    cd ../frontend
    npm install
    npm run build
  7. Move back to /backend directory, make migrations & run the application

    cd ../backend
    python manage.py makemigrations
    python manage.py migrate
    python manage.py runserver

Production

  1. Configure mailer platform & api keys in settings

    EMAIL_HOST = 'smtp.gmail.com' # mail / yahoo / hotmail / etc...
    EMAIL_USE_TLS = True
    EMAIL_PORT = 587
    EMAIL_HOST_USER = env('EMAIL_HOST_USER')
    EMAIL_HOST_PASSWORD = env('EMAIL_HOST_PASSWORD')
  2. Configure API host & port for axios client

    const client = axios.create({
        baseURL: 'http://127.0.0.1:8000',
        withCredentials: true,
    });
  3. Configure Gunicorn Socket & Service

    # sudo nano /etc/systemd/system/gunicorn-project.socket
    
    [Unit]
    Description=gunicorn project socket
    
    [Socket]
    ListenStream=/run/gunicorn-project.sock
    
    [Install]
    WantedBy=sockets.target
    # sudo nano /etc/systemd/system/gunicorn-project.service
    
    [Unit]
    Description=gunicorn project daemon
    After=network.target
    
    [Service]
    User=root
    Group=root
    WorkingDirectory=/home/user/path/to/django/
    ExecStart=/home/user/path/to/venv/bin/gunicorn \
        --access-logfile - \
        --workers 3 \
        --bind unix:/run/gunicorn-project.sock \
        config.wsgi:application
    
    [Install]
    WantedBy=multi-user.target
    # Start & Enable socket
    
    sudo systemctl start gunicorn-project.socket
    sudo systemctl enable gunicorn-project.socket
  4. Configure Nginx

    # sudo nano /etc/nginx/sites-available/project
    server {
        server_name domain_or_ip;
        
        location = /favicon { access_log off; log_not_found off; }
    
        location / {
            include proxy_params;
            proxy_pass http://unix:/run/gunicorn-project.sock;
        }
    
        location /static/ {
            root /home/user/path/to/django;
        }
    
        location /media/ {
            root /home/user/path/to/django;
        }
    }
    # Copy link on project & Start Nginx
    sudo ln -s /etc/nginx/sites-available/project /etc/nginx/sites-enabled
    sudo systemctl restart nginx
    sudo ufw allow 'Nginx Full'

ucrk's People

Contributors

segfaul avatar

Watchers

 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.