-
Notifications
You must be signed in to change notification settings - Fork 227
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 with the necessary packages for RMG-website
source activate rmg_env
cd RMG-website
conda env update
You may need to update django to 1.8.5 manually because we only have 1.8.4 on the anaconda channel:
pip install django==1.8.5
In order to get the web server running, you must first create a secret key for
Django. This key should be placed in the file rmgweb/secretsettings.py
. An
example of such a file, rmgweb/secretsettings.py.example
, is available. The
easiest way to generate a secret key is to initialize a dummy Django project
and copy its secret key from the settings.py
file, or visit a site such as
http://www.miniwebtool.com/django-secret-key-generator/. If you are only
developing locally, then you can simply move the rmgweb/secretsettings.py.example
file to rmgweb/secretsettings.py
; however, in production environments you are
strongly urged to use a custom key.
If running the website for the first time, enter the commands
cd RMG-website
python manage.py syncdb
python manage.py runserver
The syncdb
command may prompt you to create a superuser account, which you
must do in order to develop in portions of the website that require user
authentication.
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 at first, as the RMG database must be loaded from disk every time the web server is restarted.
When you rebuild any Model
class within a models.py file, you have to recreate the sql tables. Which is a huge pain and a bigger pain now that we upgraded to django 1.8.5.
First rebuild the sql database for that module. 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 syncdb python manage.py runserver