-
Notifications
You must be signed in to change notification settings - Fork 1
Basic Usage
ZABBIX edited this page Sep 15, 2023
·
24 revisions
Basic Usage π‘
After creating your project, you'll encounter a file named "project_name.py." Inside this file, you'll find multiple configuration sections. To run the application, simply execute this file.
Base Project structure:
project_name
βββ baseapp
β βββ domain
β β βββ user.py
β βββ views
β βββ base.js
β βββ hacker.py
βββ static
β βββ home.py
β βββ base.css
βββ templates
β βββ home.py
β βββ hacker.py
βββ project_name.py
βββ window_logo.ico
Example of setting file:
import os
from pypulse import Window, Aplication
from pypulse.Template import Template
# Defining aplication route
Aplication.Vars.APLICATION_PATH = os.path.dirname(os.path.abspath(__file__))
# Defining the templates and static files places
Template.TEMPLATE_PATH = os.path.join(
Aplication.Vars.APLICATION_PATH, 'templates')
Template.STATIC_PATH = os.path.join(
Aplication.Vars.APLICATION_PATH, 'static')
# Setting Aplications
# I you create a new aplication you need to add this here
Aplication.SetAplication('baseapp')
Aplication.SetAplication('user')
# BROWSER SETTINGS
APP_SETTINGS = {
'title': 'project_name',
'debug': False,
'debug_file_name': 'debug.log',
'window_size_x': 800,
'window_size_y': 800,
'icon_path': os.path.join(
Aplication.Vars.APLICATION_PATH, 'window_logo.ico')
}
# Initializing Browser
browser = Window.LoadBrowser(**APP_SETTINGS)
Applications in a PyPulse project work as modular components that help you organize and manage different parts of your web application.
- Project Structure: When working with PyPulse applications, it's strongly advisable to embrace the Domain-Driven Design (DDD) architecture. When initiating a project, PyPulse provides a base application by default, which you have the flexibility to modify as needed. This base application primarily serves as a starting point for your "Hello World" application. The default structure it offers includes
baseapp
βββ domain
β βββ user.py
βββ views
βββ home.py
βββ hacker.py