Code Monkey home page Code Monkey logo

physics-is-beautiful's Introduction

Physics is Beautiful

Installation

Requires Python 3.5, recommended to run in a virtual environment (virtualenv, consider using virtualenvwrapper to manage your virtual environments)

  • install requirements:
pip install -r requirements.txt

Requires PostgreSQL

  • install PostgreSQL:
brew install postgresql
  • create a db named pib: ex:
createdb pib
  • connect to pib database with postgres user and create EXTENSION
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
  • install npm:
brew install node
  • get packages (from root directory):
npm install

To run locally

  • Create a .env file in the root directory that contains just:
DJANGO_SETTINGS_MODULE=pib.local_settings
  • Build the front-end
npm run dev
  • Activate your virtual environment

  • Setup the db:

./manage.py migrate
  • Create an admin account by running /manage.py createsuperuser

  • Run:

./manage.py runserver
  • You should find the site running on http://localhost:8000

  • To login to the admin account go to http://localhost:8000/admin

  • pib will look for a default curriculum named Default Curriculum, so in the admin create a curriculum titled Default Curriculum

  • Then create a unit, module, lesson, and question, then navigate to /curriculum/ to see what you created!

Structure

Django apps:

  • pib contains the project settings.
  • curricula is the main app that produces the page at /curriculum/. The files apis.py and urls_api.py utilize the Django REST Framework to make an API for the models

Models

The model hierarchy is:

  • Curriculum (to test out the app make a curriculum called “Default Curriculum”)
  • Unit
  • Module
  • Lesson
  • Question

Deployment

www.physicsisbeautiful.com and dev.physicsisbeautiful.com are hosted on Elastic Beanstalk.

To Setup:

brew install awscli
brew install awsebcli
  • run aws configure
  • run eb init (you'll need the access id/key
  • on git develop branch run eb use pib-dev
  • on git master branch run eb use pib-prod

To Deploy:

  • eb deploy It will deploy to the proper environment depending on what branch you are on.

Launching the Dev Environment

To save money, the dev environment will not always be up. To launch the dev environment, from the develop branch, run the following command:

eb create --branch_default --cfg pib-dev --timeout 40

Follow the directions, and use "pib-dev" instead of the default "physicsisbeautiful-dev".

This will take several minutes to run. If the command fails, you can try to run, eb deploy from the develop branch. Otherwise you may need to go on the aws console (Elastic Beanstalk) and rebuild the environment. The only other piece is that if you change the dns from pib-dev.us-east-1.elasticbeanstalk.com then you will need to go to the Google Domains and modify the DNS for dev.physicsisbeautiful.com to point at the new URL of the new dev environment.

Run eb deploy once the environment is up to get the latest version of dev running in the environment.

Development

  • We respect the rules set out by pep8 with the exception of a 100 character line limit.
  • We use the flake8 python script for linting.

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.