Skip to content

Commit

Permalink
Improve the README a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Apr 25, 2024
1 parent ce0b114 commit a34482e
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 14 deletions.
55 changes: 42 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,58 @@ file on the production server)::
SENTRY_DSN=
ALLOWED_HOSTS=["*"]
DEBUG=True
LIVE=False
NAMESPACE=feinheit
OAUTH2_CLIENT_ID=...
OAUTH2_CLIENT_SECRET=...

Prerequisites:
Prerequisites
=============

* At least Python 3.8
* Install `fh-fablib <https://github.com/feinheit/fh-fablib/>`__
* Local PostgreSQL and Redis instances
* At least Python 3.11
* A local PostgreSQL instance

Local setup::
Local setup
===========

fl local
fl pull-db # Only if you have access to our server, sorry.
python3 -m venv venv
. venv/bin/activate
pip install -U pip
pip install -r requirements.txt

Development::
./manage.py prepare
./manage.py createsuperuser

fl dev
Development
===========

Code style & prettification::
./manage.py runserver

fl fmt check
Then, visit http://127.0.0.1:8000/accounts/login/?force_login=EMAIL in your
browser and replace ``EMAIL`` with the email address you used when creating the
superuser. Note that this only works when you're running with ``DEBUG=True``
**and** ``LIVE=False``, this never works in a production environment.

Compile the bootstrap library::
You should probably visit the admin panel now and add a few service types incl.
their hourly rate at http://127.0.0.1:8000/admin/services/servicetype/

yarn build-bootstrap
The admin panel is configured mostly as a read-only interface to your data,
except for the few modules where the admin panel actually works as a management
interface.

Next, visit the contacts list, add an organization, a person working at that
organization, and then you're ready to start adding projects, services etc.

Deployment
==========

I am deploying Workbench as a container, the necessary containerfile is a part
of this repository. Instead of using an ``.env`` file you should provide the
configuration through environment variables some other way. Workbench sends a
few mails directly through SMTP, so you should probably add the appropriate
``EMAIL_URL`` configuration. See
https://github.com/matthiask/speckenv/blob/main/test_speckenv_django_email_url.py
for examples.

You should set up a cronjob which runs ``./manage.py fairy_tasks`` daily. This
is a requirement for the recurring invoices functionality and other things.
1 change: 0 additions & 1 deletion workbench/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ def active(self):
@total_ordering
class User(Model, AbstractBaseUser):
USERNAME_FIELD = "email"
REQUIRED_FIELDS = ["working_time_model"]

email = models.EmailField(_("email"), max_length=254, unique=True)
is_active = models.BooleanField(_("is active"), default=True)
Expand Down
12 changes: 12 additions & 0 deletions workbench/management/commands/prepare.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from django.core.management.base import BaseCommand

from workbench.awt.models import WorkingTimeModel


class Command(BaseCommand):
help = "Prepare for the createsuperuser command"

def handle(self, **options):
wt = WorkingTimeModel.objects.first()
if not wt:
wt = WorkingTimeModel.objects.create(name="Arbeitszeitmodell")

0 comments on commit a34482e

Please sign in to comment.