Skip to content
Nicholas Ikiroma edited this page Aug 17, 2024 · 4 revisions

TailGen Usage Guide

This guide provides detailed instructions on how to use TailGen to generate and manage your Flask or FastAPI projects integrated with Tailwind CSS.

Generating a New Project

To generate a new project using TailGen, navigate to your desired directory in the terminal and run:

tailgen init

This command will prompt you to select the framework you want to use (Flask or FastAPI) and set up the project accordingly.

Options

TailGen provides several options to customize the project generation process. You can view all available options by running:

tailgen init --help

Common Options:

  • -f, --framework [flask|fastapi]: Specifies the web framework to use. If not specified, Flask is used as default.

  • -o, --output-dir : Directory where the project will be initialized [default: .]

Example:

tailgen init -f fastapi -o test_project

This command generates a new Flask project named myapp within a directory named test_project with Tailwind CSS integration and initializes a Git repository.

Running the Development Server

After generating your project, navigate into the project directory and activate the virtual environment:

On Unix or MacOS:

cd myapp
source venv/bin/activate

On Windows:

cd myapp
venv\Scripts\activate

Next, run the development server:

For Flask:

flask run

For FastAPI:

fastapi run

Your application should now be running locally. You can access it by navigating to http://127.0.0.1:5000 (for Flask) or http://0.0.0.0:8000 (for FastAPI) in your web browser.

Tailwind CSS Integration

TailGen sets up Tailwind CSS for you using Node.js and NPM. To build your CSS files, open up another terminal and ensure you're in the project directory. Run the command:

npm run build

This will generate the necessary CSS files in your static directory, watch for changes in your CSS files, and rebuild them automatically.

Troubleshooting

If you encounter any issues while using TailGen, please open an issue on our GitHub repository.

Conclusion

TailGen simplifies the process of setting up Flask or FastAPI projects with Tailwind CSS integration, allowing you to focus on building your application. For any questions or contributions, feel free to reach out through our GitHub repository.

Back to Home