124 lines
2.2 KiB
Markdown
124 lines
2.2 KiB
Markdown
# Vision-App-Template
|
|
|
|
A Template for developing a Django app for use with Datapath's Vision Dashboard.
|
|
|
|
Read the following for a cursory guide to initial app development:
|
|
https://docs.djangoproject.com/en/5.2/intro/tutorial01/
|
|
|
|
You MUST then package your application following this:
|
|
https://docs.djangoproject.com/en/5.2/intro/reusable-apps/
|
|
|
|
This packaging process will need to be automated.
|
|
|
|
You are expected to customize this readme to match the needs of your particular application.
|
|
|
|
## How to setup your dev environment
|
|
|
|
### 1. Copy this Git template into a new repo
|
|
|
|
### 2. Clone your new repo
|
|
|
|
### 3. Create and activate a virtual enviornment
|
|
|
|
```bash
|
|
python3 -m venv .venv
|
|
source .venv/bin/activate
|
|
```
|
|
|
|
### 4. Install PIP requirements
|
|
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
### 5. Create your app using Django's start app command
|
|
|
|
```
|
|
python manage.py startapp YOUR-APP-NAME
|
|
```
|
|
|
|
### 6. Configure your pyproject.toml
|
|
|
|
Be sure to update it to include the name of your project and its repo
|
|
|
|
## Tips on developing
|
|
|
|
### Use logging!
|
|
|
|
In your app, it is imperative that we have good logging. Utilize the python logging package and include the following in each of your python files that need to log.
|
|
|
|
```python
|
|
import logging
|
|
|
|
logger = logging.getLogger(__name__)
|
|
```
|
|
|
|
|
|
# The Following must be in YOUR readme
|
|
|
|
## Installation
|
|
|
|
### 1. Install the package
|
|
|
|
```bash
|
|
pip install YOUR-APP-HERE
|
|
```
|
|
|
|
Or add to your requirements.txt:
|
|
|
|
```
|
|
datapath-eval==x.y.z
|
|
```
|
|
|
|
### 2. Add required dependencies
|
|
|
|
This package requires the following dependencies:
|
|
|
|
```
|
|
Django>=5.2.11
|
|
```
|
|
|
|
### 3. Update your Django settings.py
|
|
|
|
Add the following to your INSTALLED_APPS:
|
|
|
|
```python
|
|
INSTALLED_APPS = [
|
|
# ... your existing apps
|
|
'YOUR-APP-HERE.apps.YOUR-APP-NAME',
|
|
]
|
|
```
|
|
|
|
### 4. Update your project urls.py
|
|
|
|
Add the following to your project's urls.py:
|
|
|
|
```python
|
|
from django.urls import path, include
|
|
|
|
urlpatterns = [
|
|
# ... your existing URL patterns
|
|
path('YOUR-APP/', include("YOUR-APP.urls")),
|
|
]
|
|
```
|
|
|
|
### 5. Run migrations
|
|
|
|
```bash
|
|
python manage.py migrate
|
|
```
|
|
|
|
## Usage
|
|
|
|
After installation, you can access the evaluation dashboard at:
|
|
|
|
```
|
|
http://your-domain/YOUR-APP/
|
|
```
|
|
|
|
## Requirements
|
|
|
|
- Python >= 3.11
|
|
- Django >= 5.2
|
|
|