4 Home
Gergely Polonkai edited this page 2 years ago

Requirements

Runtime and dependencies

Calendar.social runs under Python 3.6+ (tested with 3.6.5.)

To install dependencies, you will need pipenv. Some Linux distributions (like Fedora) have it in their repository. On others, you can install it with

pip install --user pipenv

Refer to its documentation for more information.

Database

The development environment is set up to use an SQLite3 database local.dbunder thecalsocialdirectory. You can use any other relational database supported by [SQLAlchemy](http://www.sqlalchemy.org/) if you set theSQLALCHEMY_DATABASE_URIvalue incalsocial/config_dev.py`.

How to set up the app

WARNING Calendar.social is in a very early phase of development. It may require a lot of legwork to make it work for you.

Install the dependencies

To do so, run

pipenv install

If you also want to do development, you may also run

pipenv install --dev

Create the env file

If you don’t mind constantly prepend your commands with env FLASK_APP=calsocial:app FLASK_ENV=development, you can skip this step. Subsequent sections assume you did not skip.

Create a file called .env in the root of the cloned repository with the following content:

FLASK_APP=calsocial:app
FLASK_ENV=development

Create the database

To create the database, you have to run the Flask shell:

pipenv run env flask shell

When you see the >>> prompt, use the following two-liner to create the database tables:

from calsocial.models import db
db.create_all()

Run the app

To start the app, you just have to run calsocial as a module:

pipenv run env flask run

After this, your local instance is available on http://127.0.0.1:5000/

Run the tests

To run tests, use pytest (PYTHONPATH needs to be set explicitly, as pipenv doesn’t do it by default):

pipenv run env PYTHONPATH=$(pwd) pytest --cov=calsocial

This will also print a nice coverage report at the end.