Giter Site home page Giter Site logo

arraypan / mhacks-website Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mhacks/mhacks-admin

0.0 1.0 0.0 5.63 MB

The official MHacks website and backend.

Home Page: http://mhacks.org/

Python 23.81% JavaScript 54.46% CSS 8.19% HTML 13.54%

mhacks-website's Introduction

MHacks Backend And Frontend

Installation

Pre-installed packages:

  • Python 2.7
  • Git
  • Postgre SQL (make sure its setup and running!)
    • For this make sure you have a database named mhacks and an empty user and password on localhost. If this is not the case update the development settings DATABASE settings to your own authentication details.

If you're running on Ubuntu/Linux and you run into this output while doing pip install -r requirements.txt:

Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/psycopg2.egg-info
    writing pip-egg-info/psycopg2.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.t$
t
    writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency$
links.txt
    writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found
    
    Error: pg_config executable not found.
    
    Please add the directory containing pg_config to the PATH
    or specify the full executable path with the option:
    
        python setup.py build_ext --pg-config /path/to/pg_config build ..$
    
    or with the pg_config option in 'setup.cfg'.
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-b$
ild-vqrPuW/psycopg2/

run sudo apt-get install libpq-dev python-dev to fix it and then run pip install -r requirements.txt to begin installation again.

Getting started:

    git clone <ssh or git link from repo>
    cd MHacks-Website
    # if <virtual environment preferred>
    virtualenv --distribute venv/
    source venv/bin/activate
    # endif
    pip install -r requirements.txt
    ./manage.py migrate
    ./manage.py runserver

URLs

`/`                             => Homepage (can be index or blackout page)
`/register`                     => Registration page (aka signup)
`/validate/<uid>/<token>`       => Validate email page
`/send_verify_email/<uid>`      => Send new verification email then redirects to login
`/login`                        => Login page
`/logout`                       => Logout then redirect to Homepage
`/reset`                        => Request to reset password
`/update_password/<uid>/<token>`=> Allows a reset of password from email link
`/dashboard`                    => Dashboard with context based on user type
`/live`                         => Live page with updates and stuff
`/v1/docs`                      => API Documentation, also includes URLs to the rest of the API and methods

Project Structure

  • Settings: config/settings.py: Has all the important configuration settings. development_settings.py: is used for local development, whereas production_settings.py should be created with the right settings and left on the production server.
  • URLs: config/urls.py: Has the high level URLs and includes URLs from different sources. MHacks/frontend/urls.py: Has the frontend URLs, MHacks/v1/urls.py has the backend endpoints.
  • Models: MHacks/models.py contains all the models that are in the database
  • Common code: MHacks/ has common code like utils and forms and decorators shared between both the frontend and backend.
  • Managers:

Important Things To Note:

(At some point this should be more fleshed out, better organized and moved to the wiki)

  • When creating forms for basically anything use Django forms and extend the generic form html file, allowing for maximum scalability and code reuse. See already implemented forms like login for how to do it correctly.
  • Always use form validators, don't do it yourself in the views. (See django docs for more)
  • Keep number of migrations as low as possible, i.e. by combining and pushing your (only one) migration only when you are certain that there will be no more changes to that part of the app. This is not necessary but is nice to keep the codebase clean and well maintained. Also once the migration is pushed don't go back and change as others may be depending on it.
  • When adding new models, remember to add it to the admin.py file so that it is exposed to the admin interface (if that behavior is wanted).
  • Keep view code small and minimal, implement maximum functionality in validators and model requirements.
  • Keep things as generic as possible thereby allowing maximum re-usability.
  • When adding API keys or anything protected, add a 'dummy' variable to development_settings.py and only then push, protected keys will be used on the backend. Never put any protected keys or anything protected in any other python file.

mhacks-website's People

Contributors

omkarmoghe avatar sigmanzero avatar peterkaplan avatar michaelm244 avatar fishythefish avatar extremelyseriouschicken avatar anksh avatar szechy avatar manavgabhawala avatar cameron-gagnon avatar mattste avatar

Watchers

Arpan Rughani 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.