Azure-Samples / azure-django-postgres-flexible-aca

Web app using Python Django backend, set up for deployment to Azure Container Apps with Azure PostgreSQL Flexible Server.
MIT License
17 stars 31 forks source link

Failed to run locally on Windows #68

Closed v-jiaodi closed 12 months ago

v-jiaodi commented 1 year ago

Describe the issue: When test Running locally on Windows, run python -m gunicorn project.wsgi:application --pythonpath src --reload, get error as follow: image

Repro Steps:

  1. Clone the repo to local.
  2. Create a Python virtual environment and activate it.
  3. Install requirements: python -m pip install -r src/requirements.txt
  4. Apply database migrations and seed initial data: python src/manage.py migrate python src/manage.py loaddata src/seed_data.json
  5. Running Locally: python src/manage.py collectstatic python -m gunicorn project.wsgi:application --pythonpath src --reload

Environment:

Expected behavior: Please confirm if it can be supported on Windows. If so, it is expected that Run locally will pass.

@pamelafox for notification.

pamelafox commented 1 year ago

Interesting, I didn't realize gunicorn didn't work on Windows. It should work inside a Dev Container in VS Code in Windows. We can probably figure out commands for each framework that will work locally on Windows - flask has its own dev server, django has its own dev server, and fastapi can be run with uvicorn. Thanks for the report! @kjaymiller

kjaymiller commented 1 year ago

@v-jiaodi can you try to run locally again?

v-jiaodi commented 1 year ago

@kjaymiller The issue still exists.

pamelafox commented 1 year ago

@v-jiaodi Can you confirm that you tried the new instructions in the updated README?

https://github.com/Azure-Samples/azure-django-postgres-flexible-aca#running-locally

It now says:

python3 src/manage.py runserver 8000

That does not use gunicorn, so I hope is that it works for you.

v-jiaodi commented 1 year ago

@pamelafox It works with the new instructions python3 src/manage.py runserver 8000.

The following templates still has this issue:

pamelafox commented 12 months ago

@v-jiaodi We have merged the README updates to those repos. Can you take a look and confirm that works for you?

v-jiaodi commented 12 months ago

It works.