This project is a web-based digital signange app, running on Django and Apache with PostgreSQL. It is a fork of https://github.com/jbittel/django-signage and uses the BSD-3 License.
- Upload media to an online database.
- Display media in an automatically rotating slideshow format.
- Manage serveral displays at once, each able to show different slides.
- Set slides to enable and disable at certain times.
- Set slides weights so that they are displayed in a desired order.
- Ubuntu 22.04
- Python 3.10.12
- Django 5.0
# https://git-scm.com/download/linux
$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:git-core/ppa
$ sudo apt update
$ sudo apt install git
$ git clone https://github.com/UBC-LFS/digital-signage
$ sudo apt update
$ sudo apt install python3-venv
$ python3 -m venv venv
$ source venv/bin/activate
$ sudo apt update
$ sudo apt install python3-pip
$ pip3 install --upgrade pip
$ cd digital-signage
$ pip3 install -r requirements.txt
# errors might occur in some packages, then install the following packages
$ sudo apt-get install python3-setuptools python3-dev libxml2-dev libxmlsec1-dev libxmlsec1-openssl
-
Rename digital_signage/settings.py.example to digital_signage/settings.py
-
Clone this Github repository
$ git clone https://github.com/UBC-LFS/digital-signage
- Install requirement dependencies
$ pip install -r requirements.txt
- Set Environment Variables in your machine:
ENGINE = os.environ["DAIRY_SIGNAGE_DB_ENGINE"]
NAME = os.environ["DAIRY_SIGNAGE_DB_NAME"]
USER = os.environ["DAIRY_SIGNAGE_DB_USERNAME"]
PASSWORD = os.environ["DAIRY_SIGNAGE_DB_PASSWORD"]
HOST = os.environ["DAIRY_SIGNAGE_DB_HOST"]
PORT = os.environ["DAIRY_SIGNAGE_DB_PORT"]
SECRET_KEY = os.environ["DAIRY_SIGNAGE_SECRET_KEY"]
- Switch DEBUG to False in a settings.py file
DEBUG = False
- Make sure there is a Media root directory to store uploaded files
MEDIA_ROOT = 'your_media_root'
- Add your allowed_hosts in settings.py
ALLOWED_HOSTS = ['YOUR_HOST']
- Create staticfiles in your directory
$ python manage.py collectstatic --noinput
# References
# https://docs.djangoproject.com/en/2.2/howto/static-files/
# https://devcenter.heroku.com/articles/django-assets
# https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Deployment
-
Create a database in Postgresql
-
Create database tables, and migrate
$ python manage.py migrate
- Load data for local testing
TBD
-
Update settings.json and advanced_settings.json files in the saml folder
-
See a deployment checklist and change your settings
$ python manage.py check --deploy
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# CSRF_COOKIE_SECURE = True
# SESSION_COOKIE_SECURE = True
# SECURE_BROWSER_XSS_FILTER = True
# SECURE_CONTENT_TYPE_NOSNIFF = True
# SECURE_SSL_REDIRECT = True
# X_FRAME_OPTIONS = 'DENY'
- Now, it's good to go. Run this web application in your production!
$ python manage.py runserver
- Timezone in settings.py https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# Choose the timezone where you live
TIME_ZONE = 'America/Vancouver'
- Test
TBD
- Create a superuser
# Reference: https://docs.djangoproject.com/en/2.2/topics/auth/default/
$ python manage.py createsuperuser --username=joe [email protected]
- Run this app
$ python manage.py runserver
For scheduling tasks
$ python manage.py runserver --noreload
- If you would like to log in through the local login, please change LOCAL_LOGIN to True in settings.py.
LOCAL_LOGIN=True
Open a new window with an URL http://localhost:8000/accounts/local_login/
Upgrade Django
pip install --upgrade django==new_version (e.g., 2.2.19)
Happy coding! Thank you.