tween a project and an app? An app is a Web application that does something – e.g., a Weblog system, a database of public records or a simple poll app. A project is a collection of configuration and apps for a particular website. A project can contain multiple apps. An app can be in multiple projects.” In order to promote code re-usability; the RiPPLE server makes use of projects where appropriate.
The services directory inside each app contains entities which are responsible for handling the business logic of the application. They should be used exclusively by the routing controllers to ensure that tasks are always completed in the same way (e.g., using the QuestionSearch is beneficial since it will automatically ensure your search results are within the current course context). Services are encapsulated into a single place.
Each App has the following files
urls.py, which contains application route definitions. Routes are not automatically added to the global application, you must also modify ripple/urls.py to import your app routes.
views.py, which contains the application controllers.
tests.py, which contains the specification verification of how the application operates. They are executed with python manage.py test.
7.2 Deployment of the RiPPLE Server
The RiPPLE server architecture is relatively simple since it builds off of one of the most popular python frameworks, however it does need some configuration to work correctly.
7.2.1 Installing Dependencies
From your terminal, make sure you can access both python (python–version) and pip (pip –version). If not, you will be unable to continue.
It is highly recommended to run python through virtualenv to ensure you are developing in an isolated environment. Django recommends doing this
This project ships with a requirements.txt file, which details all of the modules required to build and run the application. The simplest way to install them all is to run pip install -r requirements.txt from your terminal at the project root. pip will automatically read the requirements.txt file and install everything it requires. Generally you only need to do this once, but if new dependencies are added you will need to re-run pip install -r requirements.txt.
7.2.2 General Configuration
The RiPPLE server will read its configuration from what is called an environment variable. These variables are injected into the application at runtime by replacing reading from os.getenv(). These predefined variables are things such as debug mode and application secrets. Since environment variables can sometimes be sensitive (such as database passwords), it is best practice to keep them out of source control.
RiPPLE reads its environment variables from environment files, which are named .env.dev, and .env.prod for development and production respectively.
In a fresh install, the .env.dev, and .env.prod files will not exist (since they are not in source control). Instead, an .env.example file is provided which has all of the possible environment variable names, and example values for them. If you make your own .env.dev, or .env.prod files, you can place whatever you like in it, and your git client will automatically ignore anything inside of it. Supported environment values include the following:
API_LOCATION - string: A URI which points to the RiPPLE Server. Should not have a trailing ’/’.
DEVELOPMENT_ENVIRONMENT - string: A string indicating the development environment, e.g., (PRODUCTION or DEVELOPMENT)
DJANGO_KEY - string: The SECRET_KEY environment variable required by django. It should be a large unique string
PROXY_LOCATION - string: The subpath of the proxy_pass location if the application is being run through nginx and is not on the root path.
LTI_SUCCESS_REDIRECT - string: URI to redirect to after a successful LTI validation request
LTI_URL - string: URI to use in LTI validation
LTI_APP_KEY - string: Application key to pass to LTI validation service
DATABASE_TYPE - string: Database type to use (e.g., mysql, sqlite3)
DATABASE_NAME - string: Name of database to use
DATABASE_HOST - string: Host of dat