2024-11-18 21:36:50 +07:00
|
|
|
# CostaPy + Vite
|
2022-03-16 11:06:52 +07:00
|
|
|
|
2024-11-18 21:36:50 +07:00
|
|
|
Integrate Costapy with Vite, Vue, Tailwind CSS, and Mynaui Icons to create a modern web application.
|
2022-03-16 11:22:14 +07:00
|
|
|
|
2022-03-16 11:06:52 +07:00
|
|
|
## Requirement & Installation
|
|
|
|
|
2024-11-18 21:36:50 +07:00
|
|
|
- Node.js (20+ recommended)
|
|
|
|
- Python (3.8+ recommended)
|
|
|
|
- pnpm (optional, you can use npm if preferred)
|
|
|
|
|
2024-06-13 13:01:17 +07:00
|
|
|
### Clone the repository
|
|
|
|
|
|
|
|
Clone the repository with `--recursive` when cloning the repo.
|
|
|
|
|
2024-11-18 21:36:50 +07:00
|
|
|
git clone https://gitea.ditaajipratama.net/ridzimeko/costa-vite-myna.git --recursive
|
2024-06-13 13:01:17 +07:00
|
|
|
|
|
|
|
Note that if you forgot the `--recursive` flag you can do:
|
|
|
|
|
|
|
|
git submodule update --init
|
|
|
|
|
|
|
|
Note that when submodules have other submodules you need recursive option.
|
|
|
|
|
|
|
|
git submodule update --init --recursive
|
|
|
|
|
|
|
|
### Dependencies
|
|
|
|
|
2022-03-16 11:06:52 +07:00
|
|
|
You need this libraries to use CostaPy:
|
2024-11-18 21:36:50 +07:00
|
|
|
|
2024-05-12 02:28:57 +07:00
|
|
|
- bottle
|
|
|
|
- gunicorn
|
2024-06-13 12:47:26 +07:00
|
|
|
- beaker
|
2022-03-16 11:06:52 +07:00
|
|
|
- mako
|
|
|
|
|
|
|
|
You can install it with run this command
|
|
|
|
|
|
|
|
sh install.sh
|
|
|
|
|
2024-11-18 21:36:50 +07:00
|
|
|
## Usage
|
2022-06-14 14:50:07 +07:00
|
|
|
|
2024-11-18 21:36:50 +07:00
|
|
|
1. Install Node.js Packages
|
2022-06-14 14:50:07 +07:00
|
|
|
|
2024-11-18 21:36:50 +07:00
|
|
|
Install the frontend dependencies using pnpm (or any package manager like npm or yarn):
|
|
|
|
|
|
|
|
pnpm install
|
|
|
|
|
|
|
|
Alternatively, with npm:
|
|
|
|
|
|
|
|
npm install
|
|
|
|
|
|
|
|
2. Build the Project
|
|
|
|
|
|
|
|
Build the Vite project for production:
|
|
|
|
|
|
|
|
pnpm build
|
|
|
|
|
|
|
|
This will generate the build files in the `static/vue` directory.
|
|
|
|
|
|
|
|
3. Run the Backend Server
|
2022-03-16 11:06:52 +07:00
|
|
|
|
|
|
|
Use this command to start the web service
|
|
|
|
|
2024-05-12 02:28:57 +07:00
|
|
|
python3 costa.py
|
2022-03-16 11:06:52 +07:00
|
|
|
|
2024-11-18 21:36:50 +07:00
|
|
|
## Folder Structure
|
|
|
|
|
|
|
|
```
|
|
|
|
project/
|
|
|
|
├── costa.py # Bottle backend script
|
|
|
|
├── static/
|
|
|
|
├── vue # Vite build output (generated after running pnpm build)
|
|
|
|
├── src/ # Frontend source code
|
|
|
|
│ ├── components/ # Vue components
|
|
|
|
│ ├── assets/ # CSS, images, etc.
|
|
|
|
│ ├── App.vue # Main Vue component
|
|
|
|
│ └── main.js # Entry point for the Vue app
|
|
|
|
├── package.json # Node.js dependencies
|
|
|
|
├── tailwind.config.cjs # Tailwind CSS configuration
|
|
|
|
└── ...
|
|
|
|
```
|
2022-03-16 11:06:52 +07:00
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
### Global Variable (config/globalvar.py)
|
|
|
|
|
2024-05-12 02:28:57 +07:00
|
|
|
`globalvar.py` is the place for storing your Global Variable.
|
2022-03-16 11:06:52 +07:00
|
|
|
|
2024-05-12 02:28:57 +07:00
|
|
|
`baseurl` </br>
|
2022-03-16 11:12:43 +07:00
|
|
|
Is the variable for your base URL (without `/` in the end).
|
2022-03-16 11:06:52 +07:00
|
|
|
|
2024-05-12 02:28:57 +07:00
|
|
|
`title` </br>
|
2022-03-16 11:12:43 +07:00
|
|
|
Is the variable for your web title.
|
2022-03-16 11:06:52 +07:00
|
|
|
|
|
|
|
### Directory (config/directory.py)
|
|
|
|
|
2024-05-12 02:28:57 +07:00
|
|
|
`directory.py` is the place for storing your path. It is useful to calling the path more efficiently.
|
2022-03-16 11:06:52 +07:00
|
|
|
|
|
|
|
## Handling the modules
|
|
|
|
|
|
|
|
Handling the module is in `handler.py`.
|