ponder-lab / Imperative-DL-Study-Web-App

0 stars 0 forks source link

Imperative-DL-Study-Web-App

Django CI

Web App for the Imperative DL Study https://fathomless-inlet-57767.herokuapp.com

Setup/Run Instructions

Pre-requisites

Run Instructions

1) Ensure all pre-requisites above are met. 2) Install dependencies: pip install -r requirements.txt 3) Run the app: python manage.py runserver 4) Navigate to: localhost:8000 to view the app. 5) To create an admin account, python manage.py createsuperuser and follow instructions to provide account credentials.

Connect to a database

1) Create a database and configure the DATABASES dictionary in the settings.py file to connect to it. 2) Run migrations to create the schema using the commands:

python manage.py makemigrations
python manage.py migrate

3) Use SQL commands to populate the tables with data.

Populate Database with Initial Data

The database can be populated with initial data by first dumping the data into a fixture (fixtures can also be written manually). 1) To dump initial data from a specific database into a fixture (data.json for example), use the dumpdata command:

python manage.py dumpdata --exclude=auth.permission --exclude=contenttypes > ponder/fixtures/data.json

2) Fixtures can be JSON, XML, or YAML files. For YAML fixtures, pip install PyYAML. 3) To load to the database, run data migrations using the loaddata command:

python manage.py loaddata data.json

4) Then configure the group permissions from the Admin page.

Local DB

The fixture can be used to load data to a local database. 1) First connect to a local database, then configure the DATABASES dictionary in settings.py as follows:

DATABASES = {
    'default': {
        'ENGINE': '<YOUR_BUILT_IN_DB_BACKEND>',
        'NAME': '<YOUR_LOCAL_DB_NAME>',
        'USER': '<YOUR_LOCAL_DB_USER>',
        'PASSWORD': '<YOUR_LOCAL_DB_USER_PASSWORD>',
        'HOST': 'localhost',
    }
}

2) Run migrations and use the command: python manage.py loaddata data.json 3) Note that running the loaddata command will reload the data from the fixture into the database, removing any changes that you might have made to the database tables.

Testing

Use this command to run the tests in tests.py:

python manage.py test

Tests that require a database will run on a separate test database. Make sure that the USER in settings.py is granted privileges to create a database.

Docker Image

User Roles

The app has a complex relationship between different kinds of users. The roles are described in our wiki.

Admin Account

Field Value
Username admin
Password umjawaRZ7GY5C7Q

You can use this to register for accounts in the web app that is deployed on Heroku.