Description
Rocket Flask
Flask • TailwindCSS / Flowbite • API • Celery • Charts • Docker • CI/CD
Demo • Support • PRO Version (soon)
Why Rocket Flask
Supercharge your app instantly, launch faster, make $
Login users, process payments and send emails at lightspeed. Spend your time building your startup, not integrating APIs. Rocket Flask provides you with the boilerplate code you need to launch, FAST.
Rocket your startup in days, not weeks
The Django boilerplate with all you need to build your SaaS, AI tool, or any other web app. From idea to production in 5 minutes.
48+ hours of headaches
- 1 hrs to setup the project
- 2 hrs integrate tooling
- 2 hrs to handle Stripe
- 1 hrs for Docker
- 1 hr Google Oauth
- ∞ hrs overthinking...
- Quality Support via
Email
& Discord
Start With Docker
Download code
$ git clone https://github.com/app-generator/rocket-flask.git
$ cd rocket-flask
Start with Docker Compose
$ docker-compose up --build
Visit the app in the browser localhost:5085
.
Manual Build
Install modules via
VENV
$ virtualenv env
$ source env/bin/activate
$ pip install -r requirements.txt
Install Tailwind (another terminal)
$ cd static
$ yarn
$ npx tailwindcss -i ./src/input.css -o ./dist/css/output.css --watch
Start APP
$ flask run
Start Celery (async task)
- Make sure you have a Redis Server running:
redis://localhost:6379
$ redis-cli
and typeping
- In the base directory inside
tasks_scripts
folder you need to write your scripts file. - Run the celery command from the CLI.
$ export DJANGO_SETTINGS_MODULE="core.settings"
$ celery -A apps.tasks worker -l info -B
- You will see a new route
Apps -> Tasks
in the sidebar. - You can start and cancel any task from the UI.
How to switch to PostgreSQL
step :1 Install the necessary packages
Make sure you have the required packages installed. You need Flask, Flask-SQLAlchemy, and psycopg2 for working with PostgreSQL. You can install them using pip:
pip install Flask Flask-SQLAlchemy psycopg2
Step 2: Configure your Flask app
In your Flask app, you need to update the database configuration to use PostgreSQL. Open your main Flask application file (e.g., app.py) and add the following code:
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://username:password@localhost/mydatabase'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False # Optional, but recommended to suppress SQLAlchemy warnings
db = SQLAlchemy(app)
Replace 'username' and 'password' with your PostgreSQL username and password, and 'mydatabase' with the name of your PostgreSQL database.
Step 3: Define your database models
In your Flask project, you likely have database models defined using SQLAlchemy. Open the file where your models are defined (e.g., models.py). Update the import statement to use SQLAlchemy from flask_sqlalchemy:
from app import db
You can then define your models as usual using the SQLAlchemy syntax. Make sure to update any PostgreSQL-specific data types or features if necessary.
Step 4: Migrate the database
If you already have existing data and database tables, you need to perform a database migration to update the schema to match the new PostgreSQL configuration.
To use Flask-Migrate for database migrations, you need to create a migration repository. Open your terminal in the project directory and run the following commands:
flask db init
This will create a migrations folder in your project.
Next, generate an initial migration script:
flask db migrate -m "Initial migration"
This will generate a migration script based on your current models.
Finally, apply the migration to the database:
flask db upgrade
This will create the necessary tables in your PostgreSQL database.
Step 5: Run your Flask app
After completing the above steps, you can run your Flask app to start using PostgreSQL as the database. Make sure you have a PostgreSQL server running and accessible with the provided credentials.
In your terminal, run the following command:
flask run
Your Flask app will now use PostgreSQL as the database.
Add a new app/blueprint
To add a new app or blueprint in Flask, you can follow these steps:
-
Create a new Python file for your app or blueprint. You can name it something like my_app.py or my_blueprint.py.
-
Import the necessary modules and create an instance of the Flask application. For example:
from flask import Flask
app = Flask(__name__)
- Define the routes and views for your app or blueprint. You can use the @app.route decorator to specify the URL route for each view. Here's an example:
@app.route('/')
def home():
return 'Welcome to my app!'
You can add more routes and views as needed.
- If you're creating a blueprint, you need to register it with the Flask application. For example:
from flask import Blueprint
my_blueprint = Blueprint('my_blueprint', __name__)
@my_blueprint.route('/')
def home():
return 'Welcome to my blueprint!'
app.register_blueprint(my_blueprint)
Make sure to replace 'my_blueprint' with an appropriate name for your blueprint.
- Save the file and run your Flask application. You can typically run it using the flask run command in the terminal, assuming you have Flask installed and your environment is properly set up.
flask run
Flask will start the development server, and you should be able to access your app or blueprint at the specified route, such as http://localhost:5000/.
Deploy on Render
- Create a Blueprint instance
- Go to https://dashboard.render.com/blueprints this link.
- Click
New Blueprint Instance
button. - Connect your
repo
which you want to deploy. - Fill the
Service Group Name
and click on theUpdate Existing Resources
button. - Edit the Environment and specify the PYTHON_VERSION
- Version
3.11.5
was used for this deployment
- Version
- After that, your deployment will start automatically.
At this point, the product should be LIVE.
License
Rocket Flask - Open-source starter styled with Tailwind/Flowbite actively suported by AppSeed.