SciPost Code Repository

Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
To learn more about this project, read the wiki.
README.md 7.16 KiB

SciPost

The complete scientific publication portal

Dependencies

SciPost is written in Python 3.5 using Django and requires PostgreSQL 9.3 or higher. Python dependencies are listed in requirements.txt. Frontend dependencies are managed by NPM in package.json.

Getting started

Database

Make sure that Postgres is installed and running, and that a database and user are set up for it. A good guide how to do this can be found here (NOTE: stop before the 'Update settings' part).

Python version

Make sure you're using Python 3.5. If you need to use multiple versions of Python, use pyenv.

Python dependencies

Setup a virtual environment using(py)venv, and activate it:

$ pyvenv scipostenv
$ source scipostenv/bin/activate

Now install dependencies:

(scipostenv) $ pip install -r requirements.txt

Frontend dependencies

NPM will take care of frontend dependencies. To install all packages now run:

(scipostenv) $ npm install

Settings

In this project, most settings are tracked using Git. Some settings however, are still secret are and should stay that way. These settings may be saved into the secrets.json file in the root of the project. The minimum required structure is as follows, please mind the non-empty, but still invalid SECRET_KEY:

{
  "SECRET_KEY": "<key>",
  "DB_NAME": "",
  "DB_USER": "",
  "DB_PWD": ""
}

The settings files itself are saved into SciPost_v1/settings/local_<name>.py. Be sure to wildcard import the base.py file in the top of your settings file. To run the server, one can do it two ways. Either:

(scipostenv) $ ./manage.py runserver --settings=SciPost_v1.settings.local_<name>

...or for convenience export the same settingsfile path to the DJANGO_SETTINGS_MODULE variable, so that one can run the django commands are default:

(scipostenv) $ export DJANGO_SETTINGS_MODULE="SciPost_v1.settings.local_<name>"

One can of course also add the variable to the ~/.bash_profile for convenience.

Check, double check

To make sure everything is setup and configured well, run:

(scipostenv) $ ./manage.py check

Module bundler

Webpack takes care of assets in the scipost/static/scipost/assets folder. To (re)compile all assets into the static_bundles folder, simply run:

(scipostenv) $ npm run webpack

While editing assets, it is helpful to put Webpack in watch mode. This will recompile your assets every time you edit them. To do so, instead of the above command, run:

(scipostenv) $ npm run webpack-live

Sass and bootstrap

Styling will mainly be configured using .scss files in the scipost/static/scipost/scss/preconfig.scss file, relying on Bootstrap 4.0.0-beta.6. A full list of variables available by default can be found here. All modules are configured in the .bootstraprc file. Most modules are disabled by default.

Collectstatic

In order to collect static files from all INSTALLED_APPS, i.e. the assets managed by Webpack, run:

(scipostenv) $ ./manage.py collectstatic

This will put all static files in the STATIC_ROOT folder defined in your settings file. It's a good idea to use the clear option in order to remove stale static files:

(scipostenv) $ ./manage.py collectstatic --clear