Disclaimer: I am the developer of this framework.
Websites are a crucial part of any business. They are the foundation of any online business. Websites are what introduce people to your company and make it easier for them to find your business. However, to build a website, you need to know how to. Today, I will show you how to make a website in python using the
Before Installing Retica, it is recommended to create a virtual environment for your project. Create a virtual environment using the following command:
$~ python3 -m pip install --upgrade virtualenv
$~ python3 -m venv env_name
$~ source env_name/bin/activate
Retica is available via the pip package manager.
$~ pip install retica
If you don’t have pip installed, you can install it by running:
$~ python -m ensurepip —upgrade
The Retica framework comes with ReticaCLI which is a terminal-based tool that allows you to easily create a new project or run your existing projects.
To Create A New Retica Project, run:
$~ retica create
Project Name: ProjectName #Use '.' for using the current directory.
Templates Folder: templates #Jinja Templates Folder.
Plugins Folder: plugins #Default Folder To Store Plugins.
Import Frontend Libraries? (y/n): #To Be Implemented.
Creating project...
The Folder Structure:
ProjectName/
|- templates/
|- plugins/
|- app.py
|- run.py
import Retica
import Retica.Render
retica = Retica.Server(__name__)
templator = Retica.Render.TemplateRender(retica,template_dir="templates")
@retica.create_endpoint("/hello/{name}")
def index(request: Retica.Request.request, response: Retica.Response.response, **data):
response.body = f"Hello {data['name']}"
/hello/{name}
.This is a dynamic URL. Here {name}
is a placeholder for data and the value accessible from the data dictionary.from app import retica
from Retica import Sockets
http_socket = Sockets.HTTP_Socket(Sockets.gethostname(), 80)
if __name__ == "__main__":
retica.run([http_socket])
app.py
and the Sockets
module from Retica.run()
on our server instance by passing the array of sockets.
As an alternative to using this file, you can also run $~ retica run
to start the server directly from the command line.
You can create as many endpoints as you want and customize them to suit your needs. I will soon cover Jinja templating, Plugin creation, and an easy sample project.
Also Published here