Before you proceed with the installation, ensure you have the following software installed on your system:
- Anaconda or Miniconda
- Git (to clone the repository)
- MySQL (If you intend to use MySQL instead of SQLite)*
[* In older macs (using intel chips), MySQL installation needs to be carried out with the legacy password option.]
To get started, clone the MatD3 repository from GitHub:
git clone https://github.com/HybriD3-database/MatD3.git
Navigate to the MatD3 directory that was created after cloning the repository:
cd MatD3
create a new Conda environment for MatD3 using the following command:
conda create -n matd3_local pip
Activate the newly created environment using the following command:
conda activate matd3_local
- Edit the 'requirements.txt' file to remove the version requirements and mysqlclient:
Django
matplotlib
numpy
Pillow
python-dateutil
sentry-sdk
raven
python-decouple
django-nested-admin
djangorestframework
coverage
selenium
requests
Sphinx
gunicorn
sphinx_rtd_theme
django-filter>=2.4.0
- to install these, use the following command:
pip install -r requirements.txt
- Uncomment the following line in mainproject/settings.py:
DEFAULT_AUTO_FIELD='django.db.models.AutoField'
- Install geckodriver from conda conda install -c conda-forge geckodriver
Copy the provided env.example file:
cp env.example .env
Additionally, if you wish to use MySQL:
- Install MySQL client for conda
conda install -c conda-forge mysqlclient
-
in the .env file, specify that you are using MySQL: set
USE_SQLITE=False
(the Default isTrue
) -
Create a database for using with MySQL:
mysql -u <your_mysql_username> -p
This should prompt you to provide your MySQL password. After entering that, use,
create database <your_database_name>;
exit;
- Update the MySQL database name, and your MySQL user info in the mainproject/settings.py file:
# Database
...
else:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': '<your_database_name>',
'USER': config('DB_USER', default='<your_mysql_username>'),
'PASSWORD': config('DB_PASSWORD', default='<your_mysql_password>'),
'HOST': 'localhost',
'PORT': '',
}
}
To Initialize static files and perform database migrations, run the following command:
./manage.py collectstatic
./manage.py migrate
Run the following command:
./manage.py createsuperuser
Run the following command:
./manage.py runserver