Manage Statics

When you create a new app via create-app command, it will create empty main.css and main.js files in the statics directory of your app, and include them in layout.html of the selected app.

You can add any type of static files you want to the statics directory of your app.


For clarification let's take a look at the layout.html of our notes app:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}{% endblock %}</title>
    <link rel="stylesheet" href="/{{STATICS}}/notes/main.css">
    <script src="/{{STATICS}}/notes/main.js"></script>
</head>
<body>
    <!-- Page Content  -->
    {% block body %}{% endblock %}
</body>
</html>

STATICS here is a global variable you can use in your templates. If you change your statics configuration and statics directory, you don't need to worry about your templates.

The framework considers the new name for you.

So, whenever you need to add a static file to your template, you don't have to hard code it.

You can change the statics/ directory name via config.py module.

You will learn more about Global Variables in the Aurora Configuration section.