GithubHelp home page GithubHelp logo

etamax-22's Introduction

ETAMAX 2022

College Event Registration Website. (used for Etamax-2022)

Structure

Folder Description
backend Django App (Rest API)
client Next App (with SSR and SSG)

Deploy

Backend

  • Development Running the Project Locally 1. clone the repository
    git clone https://github.com/rgab1508/ETAMAX-22.git
    cd FACES-21/
    1. Setting up a Virtual Env
    python -m virtualenv venv
    1. Activating Virtual Env
    .\venv\Scripts\activate (windows)
    or
    source venv/bin/activate (Linux)
    1. Installing Dependency
    cd backend/
    pip intall -r requirements.txt
    1. Applying migrations in Database *This project uses Roll Number as the Primary key.
    python manage.py makemigrations
    1. Creating a Django Super User
    python manage.py createsuperuser
    1. Running the server
    python manage.py runserver
  • Production Deploying in a Virtual Private Server
    1. Setting up all the environment Variables required

        export DJANGO_DEBUG=False
        export OTP_VERIFY_SECRET='<RANDOM_LONG_STRING>'				
    2. Adding domain or IP in backend/backend/setting.py

        ALLOWED_HOSTS = ['127.0.0.1', '<UR_DOMAIN_OR_PUBLIC_IP>']
    3. Setting up Database Conntection You can set Environment Variables for Database Credentials in the production Server (recomended)

        export DB_NAME='<DATABASE_NAME>'
        export DB_USERNAME='<DATABASE_USERNAME>'
        export DB_PASSWORD='<DATABASE_PASSWORD>'

      or edit this file

        DATABASES = {
        	'default': {
        		'ENGINE': 'django.db.backends.postgresql_psycopg2',
        		'NAME': os.getenv("DB_NAME"),
        		'USER': os.getenv("DB_USERNAME"),
        		'PASSWORD': os.getenv("DB_PASSWORD"),
        		'HOST': 'localhost',
        		'PORT': '',
        	}
        }
      
    4. Then you can perform Steps 1 to 6 from Running the Project Locally Section

    5. Using Gunicorn to run server in Production you can follow this guide for setting up gunicorn and nginx

Frontend

  • Development Running locally

    cd client/
    yarn
    yarn dev
  • Production Use production build to make website run faster

    cd client/
    yarn
    yarn build
    yarn start

Nginx Config for running both apps in a Single Server

sudo vim /etc/nginx/sites-availabe/website

server {
	root /var/www/html;
	index index.html index.htm index.nginx-debian.html;

	server_name <DOMAIN_OR_PUBLIC_IP>;

	location /static {
		alias <PATH_TO_STATICFILES>
		# eg:  /home/<USERNAME>/ETAMAX-22/backend/staticfiles;
	}

	location /media {
		alias <PATH_TO_MEDIA>
		# eg: /home/<USERNAME>/ETAMAX-22/backend/media;
	}

	location /admin/ {
		include proxy_params;
		proxy_pass http://unix:/run/gunicorn.sock;
	}

	location /api/ {
		include proxy_params;
		proxy_pass http://unix:/run/gunicorn.sock;
	}


	location / {
		proxy_pass http://localhost:3000;
		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection 'upgrade';
		proxy_set_header Host $host;
		proxy_cache_bypass $http_upgrade;
	}
}

etamax-22's People

Contributors

adiunni avatar anushkaamte avatar dcostat04 avatar rgab1508 avatar theabbie avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.