Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a31e816

Browse files
Starter code for chapter 5, view models.
1 parent 513a7b7 commit a31e816

File tree

26 files changed

+639
-0
lines changed

26 files changed

+639
-0
lines changed

‎code/ch5-viewmodels/.idea/.gitignore‎

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎code/ch5-viewmodels/.idea/ch5-viewmodels.iml‎

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎code/ch5-viewmodels/.idea/inspectionProfiles/profiles_settings.xml‎

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎code/ch5-viewmodels/.idea/misc.xml‎

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎code/ch5-viewmodels/.idea/modules.xml‎

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎code/ch5-viewmodels/.idea/vcs.xml‎

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎code/ch5-viewmodels/main.py‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import fastapi
2+
import fastapi_chameleon
3+
import uvicorn
4+
from starlette.staticfiles import StaticFiles
5+
6+
from views import account
7+
from views import home
8+
from views import packages
9+
10+
app = fastapi.FastAPI()
11+
12+
13+
def main():
14+
configure(dev_mode=True)
15+
uvicorn.run(app, host='127.0.0.1', port=8000, debug=True)
16+
17+
18+
def configure(dev_mode: bool):
19+
configure_templates(dev_mode)
20+
configure_routes()
21+
22+
23+
def configure_templates(dev_mode: bool):
24+
fastapi_chameleon.global_init('templates', auto_reload=dev_mode)
25+
26+
27+
def configure_routes():
28+
app.mount('/static', StaticFiles(directory='static'), name='static')
29+
app.include_router(home.router)
30+
app.include_router(account.router)
31+
app.include_router(packages.router)
32+
33+
34+
if __name__ == '__main__':
35+
main()
36+
else:
37+
configure(dev_mode=False)

‎code/ch5-viewmodels/placeholder.txt‎

Whitespace-only changes.

‎code/ch5-viewmodels/requirements.txt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
fastapi
2+
uvicorn
3+
aiofiles
4+
5+
git+https://github.com/mikeckennedy/fastapi-chameleon
6+
7+
starlette
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
.form-container {
3+
padding: 50px;
4+
}
5+
6+
form.account-form > * {
7+
margin-top: 5px;
8+
margin-bottom: 5px;
9+
}
10+
11+
form.account-form h1 {
12+
text-align: center;
13+
}
14+
form.account-form button {
15+
float: right;
16+
}
17+
18+
form.account-form {
19+
margin-left: auto;
20+
margin-right: auto;
21+
max-width: 450px;
22+
background-color: #c9c9c9;
23+
border: 1px solid gray;
24+
border-radius: 5px;
25+
padding: 10px;
26+
}
27+
28+
.error-msg {
29+
text-align: center;
30+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /