This repository contains devcontainer configuration files for a Flutter + Django & PostgreSQL project.
The devcontainer is compatible with both GitHub Codespaces and a locally running devcontainer.
- Create a new repo from this template.
Important: The automated project structure setup will fail if the repo name contains non-alphanumeric characters (aside from underscores).
- Specify package versions (ignore for default versions):
- Specify the desired Flutter version using the
FLUTTER_VERSIONenvironment variable in.devcontainer/Dockerfile. - Specify the desired Django version in
requirements.txt. - All other package versions will likely require modifying the base image used by the Dockerfile.
- Specify the desired Flutter version using the
- (Optional) If the devcontainer will be run locally, install the Dart Debug Extension.
- Create a devcontainer either locally or with GitHub Codespaces.
If asked to manually locate the Flutter SDK path, enter
/usr/local/flutter/.
Use the command palette (CTRL+SHIFT+P) to search and select "Run Task" to see a list of configured tasks.
- Run the "Start Backend" task to start the Django web server.
- Navigate to the debug side bar and launch the "Flutter Run Debug" configuration.
- Once the Flutter web server has started, open
localhost:3000in a browser to view the Flutter app. - Activate the Dart Debug extension.
- (Optional) Open
localhost:8000to access Django web interfaces.
- To hot reload the Flutter app, press CTRL+S (even if autosave is enabled; this can be changed in the VSCode settings).
- Run the "Start Servers" task to start both the Flutter and Django web servers.
- Once the Flutter web server has started, Open
localhost:3000in a browser to view the Flutter app. - (Optional) Open
localhost:8000to access Django web interfaces.
- To hot restart the Flutter app, press r in the task terminal.
- If you receive an HTTP 401 status code when attempting to access Flutter via port 3000 in Codespaces, try making the forwarded port public.
- If you are unable to access the Django web interface, try removing port 8000 from VSCode's list of forwarded ports, and then adding it back manually.
- Use the "Django Migrate" task to automatically apply database migrations.
- The Flutter web server can be launched independently from Django with the "Start Frontend" task.
- Follow the comments in
.devcontainer/devcontainer.jsonand.devcontainer/docker-compose.ymlto port forward PostgreSQL.