Skip to content

Commit 07dff78

Browse files
authored
Merge pull request #5 from Azure-Samples/cruft/update
chore: accept new Cruft update
2 parents 6e5bb4e + e46ce53 commit 07dff78

File tree

7 files changed

+24
-11
lines changed

7 files changed

+24
-11
lines changed

.cruft.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"template": "https://github.com/kjaymiller/cookiecutter-relecloud",
3-
"commit": "972993b589b44e87780a333d6081776eea23af2c",
3+
"commit": "a3794bddf382c4c6fa4add5bf935ca14bca40a71",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {

.vscode/launch.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"args": [
1717
"run",
18-
"--port=50505",
18+
"--port=8000",
1919
"--no-debugger",
2020
"--reload"
2121
],

README.md

+13-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,17 @@ This project deploys a web application for a space travel agency using Flask. Th
66

77
This project has [Dev Container support](https://code.visualstudio.com/docs/devcontainers/containers), so it will be setup automatically if you open it in Github Codespaces or in local VS Code with the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers).
88

9-
If you're not using one of those options for opening the project, then you'll need to:
9+
If you're *not* using one of those options for opening the project, then you'll need to:
10+
11+
1. Start up a local PostgreSQL server, create a database for the app, and set the following environment variables according to your database configuration.
12+
13+
```shell
14+
export POSTGRES_HOST=localhost
15+
export POSTGRES_PORT=5432
16+
export POSTGRES_DATABASE=<YOUR DATABASE>
17+
export POSTGRES_USERNAME=<YOUR USERNAME>
18+
export POSTGRES_PASSWORD=<YOUR PASSWORD>
19+
```
1020

1121
1. Create a [Python virtual environment](https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments) and activate it.
1222

@@ -33,10 +43,10 @@ If you're not using one of those options for opening the project, then you'll ne
3343

3444
## Running locally
3545

36-
Run gunicorn on the app:
46+
If you're running the app inside VS Code or GitHub Codespaces, you can use the "Run and Debug" button to start the app.
3747
3848
```sh
39-
python3 -m gunicorn 'src.flaskapp:create_app()' --reload
49+
python3 -m flask --app src.flaskapp run --reload --port=8000
4050
```
4151
4252

src/flaskapp/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def create_app(test_config=None):
4949

5050
@app.cli.command("seed")
5151
@click.option("--filename", default="seed_data.json")
52-
def seed_data(filename, drop):
52+
def seed_data(filename):
5353
from . import seeder
5454

5555
seeder.seed_data(db, filename)

src/flaskapp/config/development.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
dbpass = os.environ["POSTGRES_PASSWORD"]
1111
dbhost = os.environ["POSTGRES_HOST"]
1212
dbname = os.environ["POSTGRES_DATABASE"]
13-
DATABASE_URI = f"postgresql+psycopg2://{dbuser}:{dbpass}@{dbhost}/{dbname}"
13+
dbport = os.environ.get("POSTGRES_POST", 5432)
14+
DATABASE_URI = f"postgresql+psycopg2://{dbuser}:{dbpass}@{dbhost}:{dbport}/{dbname}"
1415

1516
TIME_ZONE = "UTC"

src/templates/base.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
{% if prod %}
55
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
66
{% endif %}
7-
7+
8+
<!--main CSS theme file -->
9+
<link rel="stylesheet" href="{{ url_for('static', filename='res/css/theme.css') }}" />
10+
811
<!-- For new browsers - multisize ico -->
912
<link rel="icon" type="image/x-icon" sizes="16x16 32x32" href="{{ url_for('static', filename='res/img/favicon.ico') }}">
1013

src/tests/conftest.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ def app():
1212
"""Session-wide test `Flask` application."""
1313
config_override = {
1414
"TESTING": True,
15-
"SQLALCHEMY_DATABASE_URI": os.environ.get(
16-
"TEST_DATABASE_URL", "postgresql://postgres:postgres@localhost:5432/postgres"
17-
),
15+
# Allows for override of database to separate test from dev environments
16+
"SQLALCHEMY_DATABASE_URI": os.environ.get("TEST_DATABASE_URL", os.environ.get("DATABASE_URI")),
1817
}
1918
app = create_app(config_override)
2019

0 commit comments

Comments
 (0)