-
Notifications
You must be signed in to change notification settings - Fork 0
User Manual
Alexander Michel edited this page Oct 3, 2019
·
4 revisions
- Clone from https://github.com/adm41597/DOROTHY
- Install your dependencies from within PyCharm
- Start your virtual environment (not active yet) (in the DOROTHY directory run $ source venv/bin/activate)
$ python manage.py makemigrations
$ python manage.py migrate
- Create a new user for testing with (not yet necessary)
$ python manage.py createsuperuser
- Follow the terminal prompts from here
You should be ready to get started after this. You can run the server on default localhost:8000 through the terminal command:
$ python manage.py runserver
For further info on migrations, check the Django Docs
- Every major functionality in Django is called an "app" and has it's own view/model file. Django can auto generate the template for these apps with
python manage.py startapp <app name>
- When creating a new "app" make sure you add it to the
settings.py
file in the DOROTHY folder - To create a new migration run the command
python manage.py sqlmigrate <appname> <migration number>
followed bypython manage.py migrate
. The first command creates the migration and the second applies it to the database - So you accidentally (or intentionally) deactivated your venv? to reactivate run
source bin/activate
from the project directory. (or, if that causes an error, gocd venv\Scripts
and then runactivate.bat
) - When you want to use a model that's within a separate app you would import it similar to any other language
from patients.model import Patients
wherepatients.model
is that path to the class you want, andPatients
is the class. HOWEVER this gets weird if you need to cyclically import classes (i.e. if both Patients and Procedures import each other). The solution to this is to only use the import statement at the head of one of the files. The file that does not import the class at its head should only import the class within the methods it is used. This is due to how Django handles imports. Basically it gets stuck in a loop during initialization if you don't do this.
This User Manual is based off of the User Manual created for a school project.