-
Notifications
You must be signed in to change notification settings - Fork 1
Build & Run
The software has been developed by CESER to run as a Django/Python web app on the EPA RTP RHEL server. No build & run instructions for users is therefore required. All data uploaded to the RTP RHEL server is QA'd and uploaded by CESER/LRTD/EDAB research staff or contractor support. Access this tool @ https://qappbuilder.epa.gov for use.
Software Configuration Management (SCM) SOP for more information.
- Windows development machine preferred
- Git - https://git-scm.com/downloads a. Plus any Git clients.
- Python 3.8.1 - https://www.python.org/downloads/ a. When installing, make sure that pip gets chosen as an additional feature.
- Latest version of Pip. Included with Python installation.
-
Visual Studio 2019 - https://www.visualstudio.com/downloads/
or other Integrated Development Environment with support for Django apps.
- The free Community Edition is sufficient.
- PostgreSQL v 10 or higher.
- PgAdmin4
These steps use the Windows Command Prompt to set up the Python environments necessary for developing multiple Python projects.
- Add pip to your path if necessary.
- Install necessary packages
- pip install virtualenv
- pip install virtualenvwrapper
- pip install virtualenvwrapper-win
- Add an environment variable WORKON_HOME to specify the path to store environments. By default, this is %USERPROFILE%\Envs
- Create a QAPP Builder virtual environment with the command mkvirtualenv qappbuilder
- Switch between environments with the command workon {env_name}
A fresh clone of the repository should not have any Visual Studio related files, such as .sln, .pyproj, .vs/, etc. If it does, then delete them. You’ll need to set up your local environment anyway.
- Open Visual Studio and select File > New > Project
- In the left pane, select Python and choose ‘From Existing Python Code’
- For the location, enter the file path to the python project (C:/Git/qappbuilder)
- Name the project.
- Submit and click next. Choose manage.py as the startup file and press next.
- On this final page, select both check boxes and change the project type to Django Web Project. Click finish.
- In the solution explorer, right click on Python Environments and select Add Virtual Environment.
- Navigate the location to the virtual environment previously created (look in %USERPROFILE%\Envs). Alternatively, you can just create a new one in the default location through Visual Studio, which is inside the source code. This is okay and will be ignored by git
- In the solution explorer, right click on the new virtual environment and select install from requirements.txt
- Alternatively, you can do this via command line with the following commands
- cd /working/directory
- workon {qappbuilder_env}
- pip install –r requirements.txt
- Alternatively, you can do this via command line with the following commands
- Create a database called qappbuilder and import the latest data from the databases/ directory.
- Download and configure the local_settings.py file. Make sure to configure the proper Database settings.
- Install Git @ https://git-scm.com/downloads
- Additionally, install any GUI based client you’d like to use, such as Git Hub Desktop: https://desktop.github.com/
- Clone the repository to a local location. The Gateway uses C:\Git as the root directory, so the project is C:\Git\qappbuilder
- If the clone fails, you may need to extend the available path length and restart the cloning process:
- From the git hub install, open Git shell (Alternatively, open Powershell.exe and cd to C:\Users\username\Documents\GitHub)
- Type the command: git config –system core.longpaths true
Install postgreSQL @ https://www.postgresql.org/download/windows/
* Note: Make sure pgAdmin 4 is selected and installed.
Command ran for importing a psql data dump:
**psql -U postgres -d useeio-foodwaste -f dumpfilename**
Or if psql isn’t in the path, we cd into the psql installation directory\bin\ (location of psql.exe) and ran
**psql.exe-U postgres –d useeio-foodwaste –f “path\to\filename.sql”**
Install Python 64-bit 3.8.2 https://www.python.org/downloads/
* The installation takes a while to get started.
* When choosing additional features, make sure that pip gets installed as well.
Install VS 2019 @ https://www.visualstudio.com/vs/
* Note: There are SDK .NETFramework issues when using older VS versions.
* Install SDK (.NETFramework 4.5.2)
* Install GitHub Extension for Visual Studio
* **pip install virtualenv**
* **pip install virtualenvwrapper**
* **pip install virtualenvwrapper-win**
* Create a useeio-foodwaste virtual environment with the command **mkvirtualenv qappbuilder**
If the qappbuilder is not yet a VS project, you will need to open it in visual studio to get a proj file. Else, skip these steps
* Open Visual Studio and select File > New > Project
* In the left pane, select Python and choose ‘From Existing Python Code’
* For the location, enter the file path to the python project (C:/Git/qappbuilder)
* The project name should derive itself from the chosen file location, if not, give it a name.
* Submit and click next. Choose manage.py as the startup file and press next.
* On this final page, select both check boxes and change the project type to Django Web Project. Click finish.
* In the solution explorer on the right, right-click on 'Python Environments' and select 'Add Virtual Environment'.
* For 'Location of the virtual environment', browse to the useeio-foodwaste virtual environment location, usually found in 'C:\Users\%Username%\Envs\'
* Using the checkbox, you can let VS automatically install all required pip packages.
* In the solution explorer, expand Python Environment, right click the useeio-foodwaste environment, and select 'Install from requirements.txt'
- Set up a PostgreSQL server if one is not already installed on the machine.
- Use qappbuilder.backup to import data into your local PostgreSQL.
- In the qappbuilder Project, edit (or create if not exists) the local_settings.py file, in the same directory as all the other python code (qappbuilder> qappbuilder). This file will be imported by settings.py and used to overwrite data in the setting.py
- Change the credentials in DATABASES so that it will work with your local copy.
- Open a terminal, go into the qappbuilder>qappbuilder directory, and run the following python commands
python manage.py migrate
python manage.py createsuperuser
Follow the prompts to create the user name and password. This will be used for logging into the local version.
- Launch the application from the terminal using
python manage.py runserver
This will run the application on http://localhost:8000 by default.
[sudo yum install postgresql-server]
Installation and updating qappbuilder Web Tool on Fedora Server. Fedora Command Line. The 'dnf' command (equivalent to apt-get)
Update qappbuilder Web Tool from US EPA GitHub server https://github.com/USEPA/qappbuilder From root E4S folder, execute as su:
-
git add [file_names] (if any new files/directories were created)
- git commit -m "Insert Comments Here"
- git remote add origin https://[email protected]/USEPA/qappbuilder.git
- git push origin master/branch_name (to merge server version with github version)
- git pull origin master/branch_name (to merge github version with server version)