ByteBlogger - Social Media Website
ByteBlogger is a dynamic and engaging social media platform designed to connect individuals, foster discussions, and share diverse content in a visually appealing and interactive manner.
This code snippet demonstrates the setup and implementation of a Flask application with Supabase integration. Supabase is used to interact with a database, while Flask handles the web application framework.
The following dependencies are imported and configured at the beginning of the script:
supabase.create_client
and Client
from the Supabase library are imported to establish a connection with the Supabase database.Flask
is imported to create a web application using Flask.timedelta
from datetime
is used to manage session lifetimes.os
, json
, load_dotenv
, and flask_cors
are imported for environment variables, JSON manipulation, and CORS handling.Flask(__name__)
.load_dotenv()
.create_client(url, key)
.CORS(app)
.access_username_mapping_database()
retrieves data from the 'username_mapping' table.organize_into_accounts()
organizes retrieved data into a list of account dictionaries.get_all_accounts()
, find_username_by_email(email)
, and find_uuid_by_email(email)
provide different account-related functionalities.access_blog_database()
, blog_data_by_date()
, and organize_blog_data()
handle blog post data retrieval and organization.get_all_posts_and_comments()
returns lists of posts and comments.get_all_threads()
organizes posts and related comments into thread dictionaries.