From 9d33377ac12120a5c8825bffd8d1044e1eaa998c Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Sat, 15 Feb 2025 12:20:52 +0100 Subject: [PATCH] added README.md + main.py --- README.md | 87 ++++++++++++++++++++++++++++++++++++++++++++++++ main.py | 16 +++++++++ requirements.txt | 3 +- 3 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 README.md create mode 100644 main.py diff --git a/README.md b/README.md new file mode 100644 index 0000000..803c29d --- /dev/null +++ b/README.md @@ -0,0 +1,87 @@ +# Time Dispatcher + +### Table of contents + +* [Prerequisites](#prerequisites) +* [Installation](#installation) +* [Run the app](#run-the-app) + * [Production](#production) + * [Development](#development) +* [Updating](#updating) + + +--- + +**Time Dispatcher** is a QoL tool to help you track, analyze and allocate your time spent on various projects. +Here is a list of the main features available : +- Import tasks, projects and time imputations from CSV (compatible with [Super Productivity](https://github.com/johannesjo/super-productivity)) +- Create parents to group multiple projects +- Track your clock-ins / -outs and/or remote work +- Mark each parent as either productive or not, i.e. whether its projects take a share of the "clocked" time +- Automatically compute the time that should be reported as spent on each productive parent (for example to input in SageX) +- View your monthly working times in a nice table or in a summarized form on the dashboard + +## Prerequisites + +- Python 3+ + +## Installation + +1. Clone the repository + ```shell + git clone https://git.kb28.ch/HEL/TimeDispatcher.git + ``` +2. Go inside the project directory + ```shell + cd TimeDispatcher/ + ``` +3. Install the Python requirements + ```shell + pip install -r requirements.txt + ``` +4. Apply the database migrations + ```shell + python manage.py migrate + ``` +5. Set the appropriate settings in the `.env` file: + 1. Copy `.env.template` to `.env` + ```shell + cp .env.template .env + ``` + 2. Fill in the settings + - `DJANGO_SECRET_KEY`: The secret key used by Django. + This is a long random string. + For example, it can be generated using Python with + ```python + import secrets + secrets.token_urlsafe(64) + ``` + - `DJANGO_ENV`: Current environment, either `prod` or `dev` + - `DJANGO_HOSTS`: Comma-separated list of allowed hosts used by Django + +## Run the app +### Production +1. Start the Uvicorn server + ```shell + python main.py + ``` +2. Open [the app](http://localhost:8000/) in your browser + +### Development +1. Start the Django server + ```shell + python manage.py runserver + ``` +2. Open [the app](http://localhost:8000/) in your browser + +## Updating +(Before updating to a new version, it is recommended to back up the database file, i.e. `db.sqlite3`) + +To update to a new version: +1. Download the new sources + - from the [release page](https://git.kb28.ch/HEL/TimeDispatcher/releases) + - or pull the new version with git +2. Run the database migrations: + ```shell + python manage.py migrate + ``` \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..9147a6b --- /dev/null +++ b/main.py @@ -0,0 +1,16 @@ +import uvicorn + +from TimeDispatcher.asgi import application + + +def main(): + uvicorn.run( + application, + host="127.0.0.1", + port=8000, + workers=1 + ) + + +if __name__ == "__main__": + main() diff --git a/requirements.txt b/requirements.txt index d528fda..3a814c9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ Django~=5.1.5 djangorestframework~=3.15.2 -python-dotenv~=1.0.1 \ No newline at end of file +python-dotenv~=1.0.1 +uvicorn~=0.34.0 \ No newline at end of file