To understand the Company Guidelines for Programming, click here
In case you can't see the images below, please check Platform Setup Instructions
in the link above.
- Install the latest version of PostgreSQL
- Go with the default settings for everything except for things mentioned below.
- Check “ADD TO PYTHON PATH” or something similar on one of the pages.
- You might be asked to create a password during installation, make the password as
pass
(or change the passwords in the later steps). - When on this page, select PostGIS in spatial extensions:
- After the page above, you might encounter a checkbox to create a spatial database, no need to check that.
- SQL Shell and pgAdmin4 will be installed automatically once the installation above finishes.
- Open
pgAdmin4
and log in with the password used during installation. - Go to
Servers -> PostgreSQL 15 -> Databases
and right-click it to create a new database nameddjango
. - Go to
Servers -> PostgreSQL 15 -> Databases -> django -> extensions
- Right-click on extensions and select
create -> extension
-
Search and select
postgis
extension from the options(option not available in the image as already added)
-
Open
SQL Shell
. Everything in square brackets is the default value. Hit enter to keep the default values. Only change the default value of Database todjango
and Password topass
(installation password).
- Clone this repo and change directory in the terminal to where the repo is stored.
- Install Python version 3.8
- Execute the code in a terminal (command prompt for Windows users):
- Check if Python version 3.8 is installed using
py -0
. - Create and activate virtual environment:
py -3.8 -m venv venv
.\venv\Scripts\activate.bat
- Install all the required packages:
py -m pip install --upgrade pip setuptools wheel
pip install GDAL-3.3.3-cp38-cp38-win_amd64.whl
pip install -r requirements.txt
- Check if the requirements were installed using
pip list
- Navigate to the project's web folder and copy contents of
.env_defaults
onto a new.env
file. - Make these changes in .env (installation password is used here)
- Make sure the directory is changed to
web
before executing the following (command prompt for Windows users):
cd web
python delete_migrations.py & python manage.py makemigrations & python manage.py migrate
- Install
Firefox
web browser (contains drivers needed for the platform) - Within the same terminal, execute:
python manage.py runserver
- Visit this link http://127.0.0.1:8000/
- Register an account and you are ready to use the application
- Install brew
- Run the following command in your terminal:
brew install gdal
- Open web/main/settings.py and add the following lines at the end of the file:
GDAL_LIBRARY_PATH = '/opt/homebrew/Cellar/gdal/3.5.3/lib/libgdal.31.dylib'
GEOS_LIBRARY_PATH = '/opt/homebrew/Cellar/geos/3.11.0/lib/libgeos_c.1.dylib'
- Replace the version numbers with the versions you have installed
The following are solutions to the most common problems with the setup. In case you are still unable to set up the platform, email [email protected] with a screenshot of the issue to help you out.
In case you are having issues with particular packages:
- get the name of the package from the error displayed in the terminal
- final that package name in the requirements.txt file
- add
#
to the left of the package name (this comments the package out of the installation process) - save the requirements.txt file using
ctrl + s
- install the requirements file again
pip install -r requirements.txt
- repeat the process for all packages that give errors
- Install the packages that have been commented out using
pip install <package name and version from the requirements.txt file
, e.g.pip install Pillow==8.4.0
In case you are facing an issue installing gssapi
- try fixing the missing GSSAPI_MAIN_LIB variable using the command:
export GSSAPI_MAIN_LIB=/System/Library/Frameworks/GSS.framework/Versions/Current/GSS
- Install Pillow package:
pip install Pillow==8.4.0
If installing gdal via pip either doesn't work or isnt recognized, doing the following will work on both Windows 10 and 11:
- Run
pip debug --verbose
and look for compatible tags, e.g., cp38-cp38-win_amd64 - Download the GDAL wheel from Christoph Gohlke's Unofficial Windows Binaries for Python Extension Packages.
- Use the tags found above to determine which wheel you download.
- Install via pip install '/path/to/GDAL-3.3.3‑cp38-cp38-win_amd64.whl' (or whatever wheel it was you downloaded)
- Navigate to
/path/to/venv/Lib/site-packages/osgeo/
and take note of thegdalXXX.dll
files name e.g.,gdal304.dll
-The version name of the dll found above needs to be added to the/path/to/venv/lib/site-packages/django/contrib/gis/gdal/libgdal.py
file here:
elif os.name == 'nt':
# Windows NT shared libraries
lib_names = ['gdal304', 'gdal300', 'gdal204', 'gdal203', 'gdal202', 'gdal201', 'gdal20']
# ^ add dll name to this array if its not there
Add the following code block to your django settings.py if it does not exists (within the main folder project folder, not site-packages) before the initialization of any packages:
if os.name == 'nt':
VENV_BASE = os.environ['VIRTUAL_ENV']
os.environ['PATH'] = os.path.join(VENV_BASE, 'Lib\\site-packages\\osgeo') + ';' + os.environ['PATH']
os.environ['PROJ_LIB'] = os.path.join(VENV_BASE, 'Lib\\site-packages\\osgeo\\data\\proj') + ';' + os.environ['PATH']
Finished! Now continue with the regular setup of django. Note: If there are still issues, it's possible you might need to install GDAL on windows. As there aren't any binaries available on the GDAL website and you have to build it yourself. The easiest way to install it is by using the network installer for OSGeo4W, just do an express installation but make sure to select GDAL as an additional package.
All codes related to the COMP5703 CS36 project (e.g. AI-model & Web Application)