Create a Web Interface to a MOCA application server with Django!
Introduction
This template is an example of creating a web interface that connects to a MOCA application server. The login functionality allows you to authenticate using your MOCA application credentials. Once authenticated, you can then create custom web screens that can run MOCA commands and retrieve the results back.
The Home page has a few examples of custom dashboard widgets as a reference for your own custom web project.
Setup
Assuming you already have a working knowledge of Django project setup, do the following to get this example up and running:
- Create your virtual environment, activate it, and install the required packages in the requirements.txt file
- Start a new Django project/perform any migrations/create superuser, etc.
- Add the 'home' app to your project and register it in settings.py
- Copy the static, templates directories to your project
- Copy the backends.py file to your project
- Modify the base urls.py file to match the examples
- Modify settings.py as follows:
ALLOWED_HOSTS = ['localhost'] #for use on your local machine
TEMPLATES-->DIRS section: [os.path.join(BASE_DIR, 'wms_client/templates')]
TEMPLATES-->OPTIONS context_processors section: Add 'django.template.context_processors.request',
AUTHENTICATION_BACKENDS = ['wms_client.backends.MocaBackend', 'django.contrib.auth.backends.ModelBackend']
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
MOCA_URL = 'your MOCA URL address goes here'
WH_ID = 'your warehouse id for login goes here'
STATIC_URL = '/static/'
STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'wms_client/static'), ]