-
Notifications
You must be signed in to change notification settings - Fork 229
Setting up RMG website
You should have RMG-Py
already installed.
Clone the RMG-website
repo into your local folder.
The following command will update your rmg_env
environment and install the necessary packages for RMG-website
cd RMG-website
conda env update -f environment.yml
pip install git+https://github.com/bp-kelley/descriptastorus
In order to get the webserver running, you must first create a secretsettings.py
file. This file is intended to hold settings that are specific to a particular installation. An example file is provided in rmgweb/secretsettings.py.example
. Make a copy of that file named secretsettings.py
.
Django uses a secret key for cryptographic signing, which is set in secretsettings.py
. A dummy key is provided in the example file, which will work for basic use. For production environments, it is strongly recommended to generate a custom key. Instructions to generate a key using Python are provided in the example file, or you can use an online tool.
You also need to add '127.0.0.1'
to ALLOWED_HOSTS
in secretsettings.py
to run RMG-website locally.
If running the website for the first time, enter the commands
cd RMG-website
python manage.py migrate
python manage.py runserver
You may be prompted to create a superuser account, which you will need to access admin features on the website.
Now the website should appear on your localhost, you can visit it in any browser using the URL: http://127.0.0.1:8000/. The website may take some time to load, as the RMG database must be loaded from the disk every time the webserver is restarted.
When you rebuild any Model
class within a models.py file, you have to modify the sql tables. This step is more complex now that Django has moved to a migration model.
For production, it is necessary to create a migration. However, RMG-website has not fully transitioned to using migrations, so detailed instructions are not available at this point.
For local development, it is possible to simply recreate the necessary database tables. For instance if you changed rmgweb/rmg/models.py
, the module name is rmg
.
-
Generate sql commands for dropping the tables:
python manage.py sqlclear rmg
-
Copy the section starting with
BEGIN
and ending withCOMMIT
. -
Start the database shell:
python manage.py dbshell
-
Paste the copied commands, then use
CRTL+D
to exit. -
Regenerate the tables and start the server:
python manage.py migrate python manage.py runserver