To start building web applications with Zenith, follow these steps:
-
Create a new Python file for your application, e.g.,
app.py. -
Import the necessary modules:
import Zenith -
Create a new Zenith application instance:
app = Zenith.WApp() -
Define your webpage content using Zenith's declarative syntax. For example:
homePageContent = ''' <Container> <Header idName="header">Hello world from Zenith</Header> </Container> ''' -
Use the Zenith
Builderclass to build the webpage:builder = Zenith.Builder({"home": homePageContent}) built = builder.Build() -
Register the webpage routes with your Zenith application:
for route in builder.getRoutes(): app.register_route(f'/{route}', built[route])You can customize the route URL as per your requirements.
-
Serve the Zenith application:
app.serve() -
Open your web browser and visit
http://localhost:8000to see your Zenith application in action.
Congratulations! You have created and served your first Zenith web application.
Now you can explore further and leverage Zenith's features to build interactive and scalable web applications.