The Observatory Control System (OCS) Observation Portal django apps
Project description
Observation Portal
An API for Astronomical Observation Management
Within an observatory control system, the observation portal provides modules for:
- Proposal management: Calls for proposals, proposal creation, and time allocation
- Request management: Observation request validation, submission, and cancellation, as well as views providing ancillary information about them
- Observation management: Store and provide the telescope schedule, update observations, and update observation requests on observation update
- User identity management: Oauth2 authenticated user management that can be used in other applications
Prerequisites
Optional prerequisites can be skipped for reduced functionality.
- Python >= 3.6
- PostgreSQL >= 9.6
- A running Configuration Database
- (Optional) A running Downtime Database
- (Optional) A running Elasticsearch
Environment Variables
Variable | Description | Default | |
---|---|---|---|
General | DEBUG |
Whether the application should run using Django's debug mode | False |
SECRET_KEY |
The secret key used for sessions | random characters |
|
CSRF_TRUSTED_ORIGINS |
Comma separated list of trusted origins allowed for CSRF | None |
|
REQUESTGROUP_DATA_DOWNLOAD_URL |
The url where a user can download requestgroup data. Optionally include {requestgroup_id} in the string which will be filled in with the ID of the specific requestgroup. |
Empty string |
|
REQUEST_DETAIL_URL |
The url to frontend detail page for a Request. Optionally include {request_id} in the string which will be filled in with the ID of the specific request. |
Empty string |
|
MAX_FAILURES_PER_REQUEST |
Maximum number of times an Observation can fail per Request before the Request is marked as FAILURE_LIMIT_REACHED. 0 means there is no max. | 0 |
|
Database | DB_NAME |
The name of the database | observation_portal |
DB_USER |
The database user | postgres |
|
DB_PASSWORD |
The database password | Empty string |
|
DB_HOST |
The database host | 127.0.0.1 |
|
DB_PORT |
The database port | 5432 |
|
Cache | CACHE_BACKEND |
The remote Django cache backend | django.core.cache.backends.locmem.LocMemCache |
CACHE_LOCATION |
The cache location or connection string | unique-snowflake |
|
LOCAL_CACHE_BACKEND |
The local Django cache backend to use | django.core.cache.backends.locmem.LocMemCache |
|
Static and Media Files | AWS_BUCKET_NAME |
The name of the AWS bucket in which to store static and media files | observation-portal-test-bucket |
AWS_REGION |
The AWS region | us-west-2 |
|
AWS_ACCESS_KEY_ID |
The AWS user access key with read/write priveleges on the s3 bucket | None |
|
AWS_SECRET_ACCESS_KEY |
The AWS user secret key to use with the access key | None |
|
MEDIA_STORAGE |
The Django media files storage backend | django.core.files.storage.FileSystemStorage |
|
MEDIAFILES_DIR |
The directory in which to store media files | media |
|
STATIC_STORAGE |
The Django static files storage backend | django.contrib.staticfiles.storage.StaticFilesStorage |
|
EMAIL_BACKEND |
The Django SMTP backend to use | django.core.mail.backends.console.EmailBackend |
|
EMAIL_HOST |
The SMTP host | localhost |
|
EMAIL_HOST_USER |
The SMTP user | Empty string |
|
EMAIL_HOST_PASSWORD |
The SMTP password | Empty string |
|
EMAIL_PORT |
The SMTP port | 587 |
|
External Services | CONFIGDB_URL |
The url to the configuration database | http://localhost |
DOWNTIMEDB_URL |
The url to the downtime database | http://localhost |
|
ELASTICSEARCH_URL |
The url to the elasticsearch cluster | http://localhost |
|
Task Scheduling | DRAMATIQ_BROKER_HOST |
The broker host for dramatiq | redis |
DRAMATIQ_BROKER_PORT |
The broker port for dramatiq | 6379 |
Local Development
Set up external services
Please refer to the Configuration Database and Downtime Database projects for instructions on how to get those running, as well as the Elasticsearch documentation for options on how to run Elasticsearch.
Set up a virtual environment
Using a virtual environment is highly recommended. Run the following commands from the base of this project. (env)
is used to denote commands that should be run using your virtual environment.
python3 -m venv env
source env/bin/activate
(env) pip install numpy && pip install -r requirements.txt
Set up the database
This example uses the PostgreSQL Docker image to create a database. Make sure that the options that you use to set up your database correspond with your configured database settings.
docker run --name observation-portal-postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=observation_portal -v/var/lib/postgresql/data -p5432:5432 -d postgres:11.1
After creating the database, migrations must be applied to set up the tables in the database.
(env) python manage.py migrate
Run the tests
(env) python manage.py test --settings=test_settings
Run the portal
(env) python manage.py runserver
The observation portal should now be accessible from http://127.0.0.1:8000!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-ocs-observation-portal-3.0.11.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2727d02afebd55660a2cfb0969f3c95436f9987fb0cb8c8966f3611c939be881 |
|
MD5 | 4b82a296c0660cf331a29651387491a8 |
|
BLAKE2b-256 | 68cd62d3d9c2e894282fc21fa303cb4cf0d2f1e2f766804f0c8ec7b4bdc8641b |
Hashes for django_ocs_observation_portal-3.0.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e694b6cceb6b2cafe3447ca77f24289cd7aa6e386c552ffc18c828acd9b6cb4 |
|
MD5 | 1272a3fb8f6a65c42b4a62219f4fafeb |
|
BLAKE2b-256 | a8293da3fd4ef8dea6bb605632ecad2e0a5a87c875d38f3e12635cf67375e3e9 |