Source code for Lampsz platform
Make sure to have the following on your host:
- Python 3.10
- Node.js 18 and npm
- Poetry
- PostgresSQL
For UNIX system, also install the following packages:
- build-essential
- libpq-dev
Some Django settings are loaded through environment variables. For local
development, copy the .env.example
file to .env
file in the project
directory and fill in the content.
Also obtain the client_secret.json
file from Google developer console and update the GOOGLE_CLIENT_SECRETS
field with the content of the file.
Also obtain API KEY
from Google developer console and update the
GOOGLE_API_KEY
field with the string of the api key
To get started with local development:
-
Install required Python dependencies:
$ poetry install
-
Install frontend Javascript dependencies:
$ npm install
-
Build frontend files:
$ npm run dev
-
Activate virtual environment:
$ poetry shell
-
Export environment variable for Django settings:
$ export DJANGO_SETTINGS_MODULE=lampsz.settings.local $ export OAUTHLIB_RELAX_TOKEN_SCOPE=1 $ export OAUTHLIB_INSECURE_TRANSPORT=1
-
Apply Django database migrations:
$ python manage.py migrate
-
To start django development server:
$ python manage.py runserver
And you can now access the home page by going to 127.0.0.1:8000
To run Django tests with coverage:
$ coverage run --source='.' manage.py test
After installing the required packages through the steps above, the pre-configured linters can be run.
Running code style enforcement with flake8:
$ flake8 --config=setup.cfg
Running type checks with mypy:
$ mypy lampsz
All the linters have been configured into git pre-commit hooks. To utilize this, run
$ pre-commit install
And the hook should be run everytime when you commit.