File tree Expand file tree Collapse file tree 3 files changed +25
-4
lines changed
piccolo/apps/asgi/commands/templates/starlette Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change 11from piccolo_admin.endpoints import create_admin
2+ from piccolo_api.crud.endpoints import PiccoloCRUD
23from piccolo.engine import engine_finder
34from starlette.routing import Route, Mount
45from starlette.applications import Starlette
56from starlette.staticfiles import StaticFiles
67
78from home.endpoints import HomeEndpoint
89from home.piccolo_app import APP_CONFIG
10+ from home.tables import Task
911
1012
1113app = Starlette(
1214 routes=[
1315 Route("/", HomeEndpoint),
1416 Mount("/admin/", create_admin(tables=APP_CONFIG.table_classes)),
1517 Mount("/static/", StaticFiles(directory="static")),
18+ Mount("/tasks/", PiccoloCRUD(table=Task))
1619 ],
1720)
1821
Original file line number Diff line number Diff line change 1313
1414 <section>
1515 <h2>Migrations</h2>
16- <p>To use the admin, first run the migrations.</p>
16+ <p>To use the admin, first run the migrations. This will create the user and session tables in the database: </p>
1717 <p class="code">
1818 <span>piccolo migrations forwards session_auth</span>
1919 <span>piccolo migrations forwards user</span>
2525 </section>
2626
2727 <section>
28- <h2>Next Steps </h2>
29- <p>Add some tables to <em>tables.py</em>.</p>
30- <p>When you're ready to create migrations :</p>
28+ <h2>Custom Tables </h2>
29+ <p>An example table called <em>Task</em> exists in <em>tables.py</em>.</p>
30+ <p>When you're ready, create a migration, and run it to add the table to the database :</p>
3131 <p class="code">
3232 <span>piccolo migrations new home --auto</span>
3333 <span>piccolo migrations forwards home</span>
3434 </p>
3535 </section>
36+
37+ <section>
38+ <h2>Try it out</h2>
39+ <h3>FastAPI</h3>
40+ <ul>
41+ <li><a href="/admin/">Admin</a></li>
42+ <li><a href="/docs/">Swagger API</a></li>
43+ </ul>
44+ <h3>Starlette</h3>
45+ <ul>
46+ <li><a href="/admin/">Admin</a></li>
47+ <li><a href="/tasks/">JSON endpoint</a></li>
48+ </ul>
49+ </section>
3650 </div>
3751{% endblock content %}
Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ div.hero {
1414 padding : 5rem ;
1515}
1616
17+ a {
18+ color : # 4C89C8 ;
19+ }
20+
1721div .hero h1 {
1822 color : white;
1923 font-weight : normal;
You can’t perform that action at this time.
0 commit comments