GithubHelp home page GithubHelp logo

boomzilla / edurange-flask Goto Github PK

View Code? Open in Web Editor NEW

This project forked from edurange/edurange-flask

0.0 1.0 0.0 26.57 MB

Refactored version of the EDURange platform built on Flask

License: MIT License

Dockerfile 0.35% CSS 0.60% JavaScript 3.08% Python 39.91% HTML 39.18% Shell 12.95% C 0.40% Perl 3.54%

edurange-flask's Introduction

Edurange_Refactored license Py2&3

EDURange

Documentation can be found here

Installation

We recommend running on a clean ubuntu or debian instance. First, clone this repository

git clone https://github.com/edurange/edurange-flask.git

Next, change directory, copy the '.env.example' file to '.env' and edit it where marked

cd edurange-flask
cp .env.example .env
vim .env

Then, run the installation script, and first time npm-build

chmod +x install.sh
./install.sh
npm run build

To verify that you're ready to launch the app, check that "flask" and "celery" are recognized bash commands, and whether "docker run hello-world" works. If any of these fail, simply log out and back in, and they should work then.

Running Locally

Once installed, start the app using

npm start

Or each service can be run separately

flask run --host=0.0.0.0
celery worker -B -E -f celery.log -l DEBUG -A edurange_refactored.tasks

If you want to host the app on port 80, but don't have any WSGI set up, you can use the following iptables rules

sudo iptables -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 5000
sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 5000

Database Upkeep

If at any point there are updates to this application that require database schema changes, you can use these commands to update

flask db init
flask db migrate
flask db upgrade

If you will deploy your application remotely (e.g on Heroku) you should add the migrations folder to version control.

Make sure folder migrations/versions is not empty.

Debug Settings

Debugging settings can be enabled by editing these values in the '.env' file

FLASK_ENV=debug
FLASK_DEBUG=1
npm run build   # build assets with webpack
flask run       # start the flask server

Shell

To open the interactive shell, run

flask shell

By default, you will have access to the flask app.

Running Tests/Linter

To run all tests, run

flask test

To run the linter, run

flask lint

The lint command will attempt to fix any linting/style errors in the code. If you only want to know if the code will pass CI and do not wish for the linter to make changes, add the --check argument.

Asset Management

Files placed inside the assets directory and its subdirectories (excluding js and css) will be copied by webpack's file-loader into the static/build directory. In production, the plugin Flask-Static-Digest zips the webpack content and tags them with a MD5 hash. As a result, you must use the static_url_for function when including static content, as it resolves the correct file name, including the MD5 hash. For example

<link rel="shortcut icon" href="{{static_url_for('static', filename='build/img/favicon.ico') }}">

If all of your static files are managed this way, then their filenames will change whenever their contents do, and you can ask Flask to tell web browsers that they should cache all your assets forever by including the following line in .env:

SEND_FILE_MAX_AGE_DEFAULT=31556926  # one year

edurange-flask's People

Contributors

cookjackc avatar xennos-dis avatar kovada06 avatar selenawalshsmith avatar huynguyen7 avatar boomzilla avatar

Watchers

James Cloos 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.