-
Notifications
You must be signed in to change notification settings - Fork 6
Setting up and running your project
Once you have created a new project, you'll want to configure it so that it has the right settings and data.
All configuration settings are defined in your project's settings.py
file. A set of reasonable defaults is provided, however, it is only a subset of all available settings. Please, check out the page on all available configuration settings for more details.
Click here to watch a tutorial video about this section!
Silence provides the silence createdb
command to automatically execute any number of SQL scripts to create your database and/or set it to a controlled initial state.
To use this command, put the .sql
files that you want it to run inside the project's sql/
folder, and change the SQL_SCRIPTS
configuration parameter accordingly in settings.py
to reflect which files you want it to run and in which order, for example:
SQL_SCRIPTS = ["create_tables.sql", "populate_database.sql"]
Once this has been configured, silence createdb
will execute the specified files in the desired order, using the connection and database/schema specified in DB_CONN
.
Click here to watch a tutorial video about this section!
Silence also offers a tool to generate basic CRUD operations for all tables present in your database.
By running the silence createapi
command, Silence will create a /endpoints/default
folder and populate it with a .json file for each table in the database, implementing a basic CRUD for it. Silence will refrain from automatically generating an endpoint that you have already defined somewhere else.
To use this feature, make sure that your database already contains the desired tables, as explained in the previous section.
If you want to manually define your endpoints, or just want more information on how they are defined, please see Endpoint definition format.
Silence also serves as a web server for static files (unless explicitly disabled via the RUN_WEB
setting). The web/
folder inside your project is the web root, and thus you can place your web application there to be deployed by Silence.
The web server has no prefix. Accessing http://<address>/
will hit the index.html
file located in the root of the web/
folder. Any subfolders will work as expected, with the only exception of a route that creates a conflict with the API prefix (for example, if your API prefix is /api
, do not create an api/
folder directly in the root of web/
).
Once you have configured your project, database and defined your endpoints, you can launch the project:
silence run
Access logs, debug messages (if enabled) and uncontained exceptions will be logged to stdout.
Silence is built and maintained by the DEAL Research Group at the University of Seville.