# Aquilo Framework

A, Flutter & Django inspired, web development framework for python.

Build beautiful and responsive websites without ever needing to touch HTML, CSS, or JavaScript.
With Aquilo you can build a website entirely in python, and it will be blazing fast.

You can choose to either host your website any cloud provider that supports WSGI specifications.
Or you can build the HTML and static files for your website
and host them wherever you want.

# Installation

Aquilo is still under heavy development and is not available on Pypi yet, so you'll need to install it manually.

First you'll need to build the Aquilo package.

```bash
$ git clone https://github.com/KeloDraken/Aquilo
$ cd Aquilo
$ virtualenv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
$ python -m build
```

Then you can install it in your project via pip

```bash
$ mkdir <project_name>
$ cd <project_name>
$ virtualenv venv
$ source venv/bin/activate
$ pip install <path_to_aquilo_package>
```

# Usage

Since Aquilo is heavily influenced by Django, some commands will be familiar.

For example, if you want to create a new project, you can use the `aquilo startproject <project_name>` command.

```bash
$ aquilo startproject my_project
```

This will create a new project in the current directory.

The commands are not the only things I borrowed from Django. The initial project structure is also based on Django.

For example, when you create an Aquilo app there'll be a file called `manage.py` in the root of the project which will
contain the commands you can use.
You will use this file to handle the administrative tasks while creating your website, such as creating new apps, running the
development server, and, eventually, it will also be used
to create and run tests, creating and executing database migrations.

**Development server** <br>
To start the development server, run

```bash
$ python manage.py runserver
```

**Apps** <br>
Like Django, Aquilo is also built on the concept of apps. An app is python package that contains the code for a specific part of the
website. For example, the home page of the website is contained in an app called `home`.

To create an app, run

```bash
$ python manage.py startapp <app_name>
```

This will generate a new app in the `<project_name>/apps` directory. You will need to add the app name to the APPS list entry in the `<project_name>/config/settings.py` file.

```python
from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent.parent.parent

DEBUG = True

APPS = [
    "home",
    "<app_name>",
]
```

The order of the APPS list is important. The first app in the list will be the home app. Only 1 page is allowed to be the home page.

A new app will contain a `pages.py` file, the functions defined in file
will be used to generate the HTML for the pages. The default home page inside the home app will look like this:

```python
from aquilo import build, div, h1


def page_home():
    root = div(h1("Hello World!"))
    return build(root, title="Hello World!")
```

You'll notice that the function name has the prefix `page_`. All pages must have this prefix, or else they won't be recognised as pages.

Aquilo uses a style I first saw in the Flutter Framework, it uses a tree-like structure to create the markup.
You keep adding children to the root `div` class to create the markup.

The `build` function is used to create the markup. It takes the root element which needs to be a `div` and uses it to generate the HTML markup which is the served.

**The HTML** <br>
The HTML generated by Aquilo is written into a single HTML file called `output.html` which will the page that will served.
This file's content will always be different, depending on the page you are requesting.

# Bugs & Roadmap
- Rewrite WSGI implementation (I tried deploying a test site to PythonAnywhere, but it didn't work)
- Add more HTML tags to the parser
- Add styling capabilities for easy customisation
- Make development server watch the project for changes and reload automatically
- Build a UI component library for Aquilo based on Material Design
- Add indepth documentation in docstrings for all the functions
- Build my portfolio website with Aquilo
- Create a VSCode extension for Aquilo to help make the code more readable (I've found that it be a bit hard navigate when you have deeply nested elements)
