Easy installer documentation¶
This is a quick guide to setting up a new metadata registry based on the Aristotle Metadata Registry framework using the easy installer.
Such a server should be considered for demonstration purposes, and deployment should be done in accordance with the best practices and specific requirements of the installing agency.
For more information on configuring a more complete installation review the help article Integrating Aristotle-MDR with a Django project.
Make sure you have a server setup for hosting the project with an appropriate WSGI web server configured. If the server is only used for development, the inbuilt django server can be accessed by running the
./manage.py runserver
command.PythonAnywhere also provides a free python server suitable for development and low traffic sites.
(Optional but recommended) Configure a
virtualenv
for your server, so that the dependancies for Aristotle-MDR do conflict any other software you may be running. If you are running Aristotle on an isolated server with root privileges you may skip this step.For PythonAnywhere, information is available on installing virtualenv and configuring a new virtualenv.
Fetch the example metadata registry stored within the Aristotle-MDR GitHub repository.
On a linux machine, this can be done with the command:
pip install aristotle-metadata-registry python -m aristotle_mdr.install.easy
Run the easy installer:
aristotle_mdr.install.easy
. There are a number of command line arguments that are explained in the help documentation which can be accessed from the command line:python -m aristotle_mdr.install.easy --help
This will setup an example registry, and will prompt you for a new name, ask for a few additional settings, install requirements, setup a database and set up the static files.
If required, browse to the directory of your project that was named in the above directory, and edit the
settings.py
files to meet your requirements. Although the installer generates a pseudo-random hash for theSECRET_KEY
, It is strongly recommmended you generate a freshSECRET_KEY
. Also consider which customisations to implement using the options in theARISTOTLE_SETTINGS
dictionary - details of which can be found under Configuring the behavior of Aristotle-MDR.The example registry includes commented out lines for some useful Aristotle-MDR extensions. If you wish to use these, remove the comments as directed by the documentation in
settings.py
.If you are using a WSGI server (such as PythonAnywhere) you’ll need to either point your server to the projects
wsgi.py
file or update your WSGI configuration.For more information on configuring the PythonAnywhere WSGI server review their documentation.
Start (or restart) the development server and visit its address. In the case of a local development server this will likely be
127.0.0.1
.
Using a different database¶
The easy installer using a simple SQLite database for storing content, however for large scale production servers with multiple concurrent users this may not be appropriate. Django supports a wide range of database server which can be used instead of SQLite. However to the very specific nature of the options required to connect to a database, to use an alternate database with the easy installer a few additional steps are required.
Let the installer run to completion, without the
--dry
option, and selecting yes when askedReady to install requirements? (y/n):
.Edit your
settings.py
file and add a variableDATABASES
set to connect to your database as described in the Django documentation.Remove the
pos.db3
file that will have been created during the installation. This file is the name of the default SQLite database and can be safely deleted without any issues.Call the Django
migrate
command again using the updated settings:./manage.py migrate
Start (or restart) the development server and visit its address. In the case of a local development server this will likely be
127.0.0.1
.
Disabling the DEBUG options¶
Because of the The easy installer using a simple SQLite database for storing content, however for large scale production servers with multiple concurrent users this may not be appropriate. Django supports a wide range of database servers which can be used instead of SQLite. However to the very specific nature of the options required to connect to a a database, to use an alternate database with the easy installer a few additional steps are required.
Let the installer run to completion, without the
--dry
option, and selecting yes when askedReady to install requirements? (y/n):
.- Edit your
settings.py
file and set theDEBUG
to False:: DEBUG=False
- Edit your
Remove the
pos.db3
file that will have been created during the installation. This file is the name of the default SQLite database and will have a number of example objects and users created within it as the migrate step whenDEBUG
is set toTrue
.Call the Django
migrate
command again using the updated settings:./manage.py migrate
Start (or restart) the development server and visit its address. In the case of a local development server this will likely be
127.0.0.1
. To access the administators sections of the site you will need to create a super user.
Creating a superuser for the registry¶
Creating a superuser is covered in more depth in the Django documentation,
however a quick guide is given here. These steps assume a valid database exists
and has been appropriately set up with the Django migrate
command.
To create a super user, browse to the project folder and run the command:
$ django-admin createsuperuser
This will prompt you for a username, email and password.
A username and email can be applied with the --username
and --email
switches respectively. For example:
$ django-admin createsuperuser --username=my_registry_admin --email=admin@registry.example.gov