-
Notifications
You must be signed in to change notification settings - Fork 67
Development Setup
Mathieu Rampant edited this page Aug 19, 2022
·
18 revisions
For Windows Users, it is recommended to install all the programs as Administrator
- Check if you have Python (3.6+) installed by running
python --version
- If you don't have python on your system, download the latest version on Python's Website
- Install it. Make sure to check "Add Python to PATH" on Windows
- Check if you have git installed by running
git --version
- If you don't have it already, install Git using
apt-get install git
,dnf install git
oryum install git
. If you are running MacOS, simply rungit --version
and it should prompt you to install it If you are running Windows, I recommend installing git bash
- Go to Pycharm Download Page
- Download the right version of Pycharm for your system
- Install it
- Start Pycharm and select "Checkout from Version Control", then select "Git"
- Use the following parameters:
- URL:
https://github.com/usnistgov/NEMO.git
- Directory: <the directory where you want NEMO's code to be>
- The code should now be downloaded and the project should be available in Pycharm
- Go to "File -> Settings" (windows) or "Pycharm -> Preferences" on MacOS
- Go to "Project: NEMO -> Project Interpreter"
- Click on "No Interpreter" then "Show All..."
- Click on "+" to create a new interpreter.
- Select "Virtualenv Environment". Base Interpreter should be already selected as the version you installed in step 1
- Click "Ok"
- In the left side panel, right click on the second NEMO folder (NEMO -> NEMO) and select "New -> Python File"
- Enter the name
settings
and confirm. - In the settings.py file, if you see a notification to install package requirements, do it.
- In settings.py, paste the settings from Settings
- Make sure you have in settings.py:
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUG = True
-
'NEMO.middleware.RemoteUserAuthenticationMiddleware'
is in middleware - Uncomment
AUTHENTICATION_BACKENDS = ['NEMO.views.authentication.RemoteUserAuthenticationBackend']
ALLOWED_HOSTS = ['localhost']
- use file email backend with
EMAIL_FILE_PATH = os.path.join(BASE_DIR, 'email_sink/')
- database with name
'NAME': os.path.join(BASE_DIR, 'nemo.db'),
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_ROOT = os.path.join(BASE_DIR, 'resources/icons')
- for file logging, use
"filename": os.path.join(BASE_DIR, "nemo.log"),
- for error_file logging, use
"filename": os.path.join(BASE_DIR, "nemo_error.log"),
- in the bottom of the Pycharm IDE, click "Terminal"
- execute
pip install .
(this step can take several minutes) - execute
cd NEMO
thenpython manage.py migrate
- execute
python manage.py loaddata ../resources/fixtures/splash_pad.json
- In the top right corner of Pycharm, click "Add Configuration..."
- Click "+" and select "Python", then enter the following:
- "Name":
start nemo
- "Script Path":
manage.py
- "Parameters":
runserver localhost:8000
- In "Environment Variables", add
REMOTE_USER
key and valuecaptain
- In "working directory", select the second NEMO folder (NEMO/NEMO)
- Click "Apply"
You can now run your saved configuration and access NEMO at http://localhost:8000
If you want to login as someone else, simply change the REMOTE_USER environment variable to another username (like "ned" or "professor")