Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Latest commit

 

History

History
143 lines (97 loc) · 3.97 KB

README.rst

File metadata and controls

143 lines (97 loc) · 3.97 KB

Project layout

The project layout was made in such a way that code is seperated from non-code files that you typically want to serve in another way (static and media files) or keep in a different location (like the virtual environment):

modelbouwdag
|
+-- env                 -- Virtual environment files.
|
+-- src                 -- Container for one or more source directories.
|   |
|   +-- modelbouwdag
|       |
|       +-- conf        -- Django settings files.
|       |
|       +-- templates   -- Project templates
|       |
|       +-- wsgi        -- Default location for wsgi deployment scripts
|       |
|       +-- static      -- Default location for project static files
|       |
|       +-- ...         -- Project specific applications.
|
+-- static              -- Default location for collected static files.
|
+-- media               -- Default location for uploaded media files.
|
+-- log                 -- All log files generated by the project.
|
+-- doc                 -- Documentation source and generated files.
|
+-- requirements        -- Project requirements for each type of installation.

Installation

New installations (for development or production) should follow the steps below.

  1. Navigate to the location where you want to place your project.

  2. Get the code:

    $ git clone ssh://[email protected]/maykinmedia/modelbouwdag.git
    $ cd modelbouwdag
    
  3. Bootstrap the virtual environment and install all required libraries. The boostrap.py script basically sets the proper Django settings file to be used:

    $ python bootstrap.py <production|staging|test|development>
    
  4. Activate your virtual environment and create the statics and database:

    $ source env/bin/activate
    $ python src/manage.py collectstatic --link
    $ python src/manage.py migrate
    

Developers

Optionally, you can load demo data and extract demo media files:

$ python src/manage.py loaddata demo
$ cd media
$ tar -xzf demo.tgz

You can now run your installation and point your browser to the address given by this command:

$ python src/manage.py runserver

If you are making local, machine specific, changes, add them to src/modelbouwdag/conf/local.py. You can base this file on the example file included in the same directory.

Install the front-end CLI tools if you've never installed them before:

$ npm install -g jspm gulp

Enable watch tasks:

$ gulp

By default this will compile the sass to css on every sass file save.

For more information on SASS, see: http://sass-lang.com/. For the common mixins, Bourbon is used, see http://http://bourbon.io/.

Get all Javascript libraries:

$ npm install
$ jspm install

For more information on Node.js, see: http://nodejs.org/ and http://jspm.io/

Staging and production

Configure your webserver and/or WSGI handler. See: https://docs.djangoproject.com/en/dev/howto/deployment/

Note that your wsgi script in ``src/modelbouwdag/wsgi.py already points to your staging|production settings.py file. This happens when bootstrapping your environment.

Update installation

When updating an existing installation:

  1. Activate the virtual environment:

    $ cd modelbouwdag
    $ source env/bin/activate
    
  2. Update the code and libraries:

    $ git pull
    $ pip install -r requirements/<production|staging|test|development>.txt
    
  3. Update the statics and database:

    $ python src/manage.py collectstatic --link
    $ python src/manage.py migrate
    

Custom management commands

Management commands are often run in a cronjob with stdout redirected to a log file.

Make sure to use the 'maven' management command, so use:

$ python src/manage.py maven my_custom_management_command >> log/my_command.log 2>&1

This ensures that uncaught exceptions end up in Sentry instead of being overlooked in the log files