Giter Site home page Giter Site logo

jumbograde's Introduction

Jumbograde

Installation

Make sure you have the latest version of pip installed. If you don't have virtualenv installed:

pip install virtualenv

You can store your virtualenvs wherever you want. I keep them in ~/.virtualenv.

mkdir ~/.virtualenv
cd ~/.virtualenv

Create a virtualenv for this project in the directory you created above:

virtualenv jumbograde

Then, go to the root of the project. Activate your virtualenv:

source ~/.virtualenv/jumbograde/bin/activate

Install all the requirements:

pip install -r requirements.txt

You only need to do those steps once after you have cloned the repository locally.

Running

We run locally using a sqlite3 database. The file will be called db.sqlite3. In production, we would be using a MySQL database provided by EECS IT.

To be able to run with full functionality, you need to perform an additional step. These would have to be redone whenever our database schema changes. Django would warn you about these in red text, so don't worry about tracking those changes, just do the steps again whenever it happens.

./manage.py migrate

Another thing you have to do at this point (only for the very first time) is create a superuser for your particular database file.

./manage.py createsuperuser

And you're set! To run a local development server:

./manage.py runserver

Templates

Templates common to more than one app go in the root jinja2 folder.

Templates specific to apps must be placed according to the following directory structure:

<project_root>
|   <app_name>
    |   jinja2
        |  <app_name>
           |   <template_name>.html.j2

Notice that <app_name> is repeated. This is because Jinja2 collates all template files together in one 'virtual' directory. If you have a template with the same name in two apps, they'll conflict. So, we namespace all templates using their app's name. To use a template, you'll use the string app_name>/<template_name>.html.j2 to refer to it. An example is given in the urls.py file of the core app. Just modify the template for test_endpoint to whatever you create to test your templates, but please make sure you restore it to core/test.html.j2 before committing.

We only have one app right now, so it is okay for layout.html.j2 to be the only file in the root jinja2 folder. Any templates you may create are most likely going inside app-specific template directories.

Static Files

Static files common to more than one app go in the root static folder.

Static files specific to apps must be placed according to the following directory structure:

<project_root>
|   <app_name>
    |   static
        |  <app_name>
           |   <file_name>.css

To include a static file in a template, you must not hardcode the URL. Use the static Jinja2 environment function instead:

<link rel="stylesheet" type="text/css" href="{{ static('core/test_styles.css') }}">

The full path will be resolved at runtime, depending on what storage methods we end up using for our static files.

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.