Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added OSGEO4W path setups and OS agnostic URL joins #251

Closed

Conversation

Sean-S-Wang
Copy link
Contributor

Added windows compatibility for native deployment/development

Additional notes for setting up on Windows:

Setting up native development in windows for RD WATCH

  1. Install python 3.10 without conda and deactivate conda environments, including base
  2. Set the environment variables in .env.
  3. Run docker compose -f ./docker-compose.yaml up -d
  4. pip install psycopg2-binary
  5. Install poetry
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
  1. Install/create python env with poetry
poetry --directory django install

You might have to install Visual C++ build tools 14.0+
Just follow the link in the error message and make sure you check off the build tools

Make sure .py files are associated with python interpreter. Cannot be conda.

or

Set poetry interpreter in pycharm. This is what I am doing.

  1. Set up environment variables
    The intent is to just set the variables present in the .env and dev/.env.docker-compose-native files. Do it any way you see fit, including manually via the windows UI.

The following is a scripted way

get-content .env.docker-compose-native | foreach {
    $name, $value = $_.split('=')
    [Environment]::SetEnvironmentVariable($name, $value, 'User')
}

Run this .ps1 script to set environment variables in windows powershell

. .\export-env.ps1  

You have to remove empty lines and comments from the .env files, or else you will get an error about 0 length variables.

Also make sure there are no quotation marks!!

Also, need to install gdal via this method. Conda will not work
https://trac.osgeo.org/osgeo4w/

Select advanced installation and ensure gdal and the gdal303-runtime are selected. The dependencies should automatically be installed after.

poetry run --directory django .\django\src\manage.py runserver

or

run manage.py in pycharm after setting up interpreter. Make sure to restart pycharm if you are using it to update os.environ and environment variables.

Run, in a separate terminal,
poetry run --directory django celery --app rdwatch.celery worker --loglevel INFO --without-heartbeat

If you get an error about finding some gdal304.dll, go to the location and rename it to gdal304.dll.orig, and do the same for any other potential environments on the PATH. For me, I found one in the base anaconda environment.

Run, in a separate terminal,
poetry run --directory django celery --app rdwatch.celery beat --loglevel INFO

Run, in a separate terminal,
cd vue
npm run dev

to spin up the front end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant