A community-focused social network for building and managing monthly calendars together. Users can post events to a timeline (similar to Facebook), view events on an interactive calendar, and engage with the community through comments.
- User Authentication: Complete registration, login, and profile management system
- Profile Management: Upload profile images and customize your display name
- Timeline UI: Facebook-style feed for posting and viewing events
- Calendar View: Interactive calendar powered by FullCalendar library
- Event Details: Click events on the calendar to view full details and comments in a modal
- Comments: Engage with events through a commenting system
- Admin Panel: Manage users, promote/demote admins, and moderate events
- Secure by Default: Built on Google's Secure Scaffold with CSRF protection, CSP headers, and more
- Backend: Python Flask 3.0
- Database: Google Cloud Datastore (NDB)
- Frontend: Bootstrap 5, FullCalendar, Font Awesome
- Platform: Google App Engine (Python 3.11)
- Security: Flask-Talisman (CSP), Flask-SeaSurf (CSRF protection)
community-calendar/
├── main.py # Main Flask application
├── models.py # Database models (User, Event, Comment)
├── settings.py # Flask configuration
├── requirements.txt # Python dependencies
├── app.yaml # App Engine configuration
├── run.sh # Local development script
├── templates/ # HTML templates
│ ├── base.html # Base template with navbar
│ ├── login.html # Login page
│ ├── register.html # Registration page
│ ├── profile.html # User profile page
│ ├── timeline.html # Timeline feed
│ ├── event.html # Single event view
│ ├── calendar.html # Calendar view
│ └── admin.html # Admin panel
└── static/ # Static assets
├── css/
│ └── style.css # Custom styles
├── js/ # Custom JavaScript
├── img/ # Images
│ └── default-avatar.svg
└── uploads/ # User uploaded images
- Install Python 3.11 or higher
- Install the Google Cloud SDK
- Initialize the SDK:
gcloud init
-
Clone or navigate to the project directory:
cd community-calendar -
Create a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Start the Cloud Datastore Emulator (in a separate terminal):
gcloud beta emulators datastore start --no-store-on-disk --consistency=1.0 --host-port=localhost:8081
-
Set environment variables:
export DATASTORE_EMULATOR_HOST=localhost:8081 export DATASTORE_PROJECT_ID=community-calendar-dev
-
Run the Flask development server:
python main.py
Or use the provided script (Unix/Linux/Mac):
./run.sh
-
Visit the application: Open your browser to http://localhost:8080
- Register a new account at http://localhost:8080/register
- The first user you create should be made an admin manually in the database, or you can modify the code temporarily to set
is_admin=Truefor your first user - Once you have an admin account, you can promote other users to admin through the Admin Panel
-
Create a Google Cloud Project:
gcloud projects create community-calendar-prod --name="Community Calendar" gcloud config set project community-calendar-prod
-
Enable required APIs:
gcloud services enable datastore.googleapis.com gcloud services enable cloudbuild.googleapis.com
-
Initialize App Engine:
gcloud app create --region=us-central
-
Update the secret key in
settings.pyor set it as an environment variable inapp.yaml:env_variables: SECRET_KEY: "your-production-secret-key-here"
gcloud app deploy --project community-calendar-prod app.yamlAfter deployment, visit: https://community-calendar-prod.appspot.com
gcloud app logs tail -s default- Register/Login: Create an account or log in
- Create Events: Use the timeline to post new events with date, time, location, and description
- View Timeline: See all community events in a feed format
- View Calendar: Switch to calendar view to see events on an interactive calendar
- Comment: Click on events to view details and add comments
- Update Profile: Upload a profile image and update your display name
- Access Admin Panel: Click "Admin" in the navigation bar
- Manage Users: View all users, promote/demote admin status
- Moderate Events: View and delete any event
- View Statistics: See total users, events, and admin count
/or/timeline- Main timeline feed (requires login)/calendar- Calendar view (requires login)/register- User registration/login- User login/logout- User logout/profile- User profile management/event/<id>- View single event with comments/admin- Admin panel (requires admin privileges)/api/events- JSON API for calendar events/api/event/<id>- JSON API for event details
- CSRF Protection: All forms protected with CSRF tokens via Flask-SeaSurf
- Content Security Policy: Strict CSP headers via Flask-Talisman
- HTTPS Only: All traffic forced to HTTPS
- Secure Headers: X-Frame-Options, X-Content-Type-Options, HSTS
- Password Hashing: Passwords hashed with SHA-256
- Session Security: Secure, HttpOnly, SameSite cookies
Edit main.py and add routes with the @admin_required decorator:
@app.route('/admin/custom-feature')
@admin_required
@ndb_context
def custom_admin_feature():
# Your code here
return flask.render_template('custom.html')Edit static/css/style.css to customize the appearance.
The current implementation saves uploaded images locally. For production, modify the upload_profile_image() function in main.py to upload to Google Cloud Storage instead.
If you get connection errors:
- Make sure the emulator is running on port 8081
- Ensure environment variables are set correctly
- Try restarting the emulator
If external resources don't load:
- Check
settings.pyCSP_POLICY configuration - Add the domain to the appropriate CSP directive
If you get import errors:
pip install --upgrade -r requirements.txtCopyright 2025 Community Calendar
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This project is built on Google's Secure Scaffold for App Engine.
For issues, questions, or contributions, please open an issue on the project repository.