Skip to content

Having trouble running a local dev version #4

Description

@TD22057

Thanks for creating this tool, it's been very useful. This isn't a bug report at all - just me having trouble running the server locally.

I'm trying to run a local version so I can play around with the cost functions (I'd like to minimize actual number of buildings, not building utilization) but am running into issues and so far have been unable to solve them.

I'm running on Ubuntu under WSL. I installed python 3.12 (using conda), created a venv, and installed the requirements. When I tried to migrate, it failed with an error about django not being able to write to a settings file (but no path listed). I found the path in satopt/settings.py and fixed that to a local directory which allowed me to start up the server. However when I try to connect, the connection always gets shifted to https and fails.

Django version 5.2.7, using settings 'satopt.settings'
Starting development server at http://127.0.0.1:8081/
Quit the server with CONTROL-C.

WARNING: This is a development server. Do not use it in a production setting. Use a production WSGI or ASGI server instead.
For more information on production servers see: https://docs.djangoproject.com/en/5.2/howto/deployment/
[20/Aug/2026 23:35:07] "GET / HTTP/1.1" 301 0
[20/Aug/2026 23:35:07] code 400, message Bad HTTP/0.9 request type ('\x16\x03\x01\x07K\x01\x00\x07G\x03\x03\x16qÚ\x06pm»i')
[20/Aug/2026 23:35:07] You're accessing the development server over HTTPS, but it only supports HTTP.

I tried all major browsers (entering 'http://127.0.0.1:8081' as well as localhost) but they all shift to https. I edited settings.py to have the following to try and turn off HTTPS but nothing seems to work:

CSRF_TRUSTED_ORIGINS = [ 'http://localhost:8081', 'http://127.0.0.1:8081' ]

ALLOWED_HOSTS = ['*']
USE_X_FORWARDED_HOST = False
#SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")

# Force HTTPS redirects at Django level
SECURE_SSL_REDIRECT = False
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = False

# Enable HSTS after confirming HTTPS works
SECURE_HSTS_SECONDS = 0 # 31536000  # 1 year
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
SECURE_HSTS_PRELOAD = False

Every browser I try (including changing all possible settings on the browser) reports an invalid HTTPS session and won't connect. I'm guessing that since the django log shows a a GET/HTTP call that somehow django is shifting it to HTTPS.

Any help or ideas would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions