Access and setup¶
The repository of the MatD3 database is hosted by GitHub:
It’s a public project, so anybody is able to clone the source code and create issues and merge requests. In order to contribute to the project directly, contact one of the MatD3 team members who will then grant you the developer status. For pull/push privileges you must upload your RSA public key to GitLab. If you already have one, it is likely located at ~/.ssh/id_rsa.pub
. If not, the RSA public/private key pair can be generated by issuing
ssh-keygen
It is sufficient to press enter at each query until the keys have been generated. However, protecting the key with a password would be a good idea if you intend to keep it on a public server. Then, at the GitLab website, go to your settings, find “SSH keys”, and enter the public key. You can upload several keys in order to have pull/push access from more than one computer. You can now clone the Git repository with
git clone https://github.com/HybriD3-database/MatD3.git
In order to ensure compatibility with the correct Python packages, it is important to do any development in a Python virtual environment. You can create a virtual environment with
python3 -m venv venv
and activate the environment with
source venv/bin/activate
You’ll notice that the shell’s prompt has changed to remind you that you are in a virtual environment. Any packages installed with Python’s pip
command are now part of the current project only. The correct versions of the packages that are required for developing the MatD3 database are listed in requirements.txt. Install them all by issuing
pip install -r requirements.txt
When you make changes to the requirements, such as upgrading a Python package, use
pip freeze > requirements.txt
to record the new list of requirements. Since this will overwrite the current requirements file, it is important to apply the old requirements first before making any changes.
Before starting the server, it is necessary to configure it in order to reflect your specific environment. The configuration variables are read from a file called .env
in the root directory. You need to create this file or make a copy of env.example
in the root directory and edit it.
- SECRET_KEY
- Used for cryptographic signing. The default value is only for quickly setting up the server and should not be used in practice.
- MATD3_NAME
- Name of this instance of the server
- MATD3_URL
- URL of this instance of the server
- ALLOWED_HOSTS
- List of host/domain names that this instance can serve
- EMAIL_HOST
- The host to use for sending email.
- EMAIL_HOST_USER
- Username to use for the SMTP server defined in EMAIL_HOST
- EMAIL_HOST_PASSWORD
- Password to use for the SMTP server defined in EMAIL_HOST
- SELENIUM_DRIVER
- Which driver to use for running tests with Selenium. Options are “Firefox” and “Chrome” (case insensitive). If not present, Firefox is used.
- USE_SQLITE
- Whether to use the SQLite database. If false or not present, mySQL is used instead.
- DEBUG
- Whether to run MatD3 in debug mode. This is useful for quickly setting up and testing the website but should be removed when serving on a production server.