2 days left: Lock in the best discounts for TechCrunch Disrupt 2026
Back to Tutorials
techTutorialintermediate

2 days left: Lock in the best discounts for TechCrunch Disrupt 2026

February 26, 20266 views6 min read

Learn to build a complete event registration system using Python Flask that handles user registrations, form validation, and displays discount information similar to TechCrunch Disrupt 2026.

Introduction

In today's fast-paced digital world, event registration systems are crucial for managing large-scale conferences and gatherings. This tutorial will teach you how to build a simple event registration system using Python and Flask, similar to what might power the TechCrunch Disrupt 2026 registration process. You'll learn how to create a web interface for users to register for events, handle form submissions, and manage registration data.

Prerequisites

  • Basic Python knowledge
  • Python installed on your system
  • Flask web framework installed
  • Basic HTML and CSS knowledge
  • Understanding of web forms and HTTP requests

Step-by-step Instructions

1. Setting up the Development Environment

1.1 Install Required Packages

First, we need to install Flask to create our web application. Open your terminal and run:

pip install flask

Why: Flask is a lightweight web framework that makes it easy to build web applications in Python. It provides the foundation for our registration system.

1.2 Create Project Structure

Create a new directory for your project and set up the following structure:

event_registration/
├── app.py
├── templates/
│   ├── index.html
│   └── registration.html
└── static/
    └── style.css

Why: Organizing files in this structure keeps our code clean and maintainable, separating logic, templates, and static assets.

2. Creating the Main Application

2.1 Build the Flask Application

Create a file called app.py with the following content:

from flask import Flask, render_template, request, redirect, url_for, flash

app = Flask(__name__)
app.secret_key = 'your-secret-key-here'

# In-memory storage for registrations (in production, use a database)
registrations = []

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/register', methods=['GET', 'POST'])
def register():
    if request.method == 'POST':
        name = request.form['name']
        email = request.form['email']
        event = request.form['event']
        
        # Basic validation
        if not name or not email or not event:
            flash('All fields are required!')
            return redirect(url_for('register'))
        
        # Store registration
        registration = {
            'name': name,
            'email': email,
            'event': event
        }
        registrations.append(registration)
        
        flash('Registration successful!')
        return redirect(url_for('index'))
    
    return render_template('registration.html')

if __name__ == '__main__':
    app.run(debug=True)

Why: This creates the main Flask application with routes for the homepage and registration form, including form handling and basic validation.

3. Creating HTML Templates

3.1 Create the Homepage

Create templates/index.html with this content:

<!DOCTYPE html>
<html>
<head>
    <title>TechCrunch Disrupt 2026</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
    <div class="container">
        <h1>TechCrunch Disrupt 2026</h1>
        <p>Register now to secure discounts of up to $680! Offer ends tomorrow, February 27.</p>
        <a href="{{ url_for('register') }}" class="btn">Register Now</a>
    </div>
</body>
</html>

Why: This creates the main landing page that introduces the event and provides a clear call-to-action for registration.

3.2 Create the Registration Form

Create templates/registration.html with this content:

<!DOCTYPE html>
<html>
<head>
    <title>Register for TechCrunch Disrupt 2026</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
    <div class="container">
        <h2>Register for TechCrunch Disrupt 2026</h2>
        
        <!-- Display flash messages -->
        {% with messages = get_flashed_messages() %}
            {% if messages %}
                {% for message in messages %}
                    <div class="alert">{{ message }}</div>
                {% endfor %}
            {% endif %}
        {% endwith %}
        
        <form method="POST" action="{{ url_for('register') }}">
            <div class="form-group">
                <label for="name">Full Name</label>
                <input type="text" id="name" name="name" required>
            </div>
            
            <div class="form-group">
                <label for="email">Email Address</label>
                <input type="email" id="email" name="email" required>
            </div>
            
            <div class="form-group">
                <label for="event">Event Type</label>
                <select id="event" name="event" required>
                    <option value="">Select an event</option>
                    <option value="conference">Conference Pass</option>
                    <option value="workshop">Workshop Pass</option>
                    <option value="premium">Premium Pass ($680 discount)</option>
                </select>
            </div>
            
            <button type="submit" class="btn">Complete Registration</button>
        </form>
        
        <p><a href="{{ url_for('index') }}">Back to homepage</a></p>
    </div>
</body>
</html>

Why: This creates the registration form with fields for user information and event selection, including proper form validation and user feedback.

4. Adding Styling

4.1 Create CSS Styles

Create static/style.css with this content:

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h1, h2 {
    color: #333;
}

.btn {
    background-color: #007bff;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    margin: 10px 0;
}

.btn:hover {
    background-color: #0056b3;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input, select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.alert {
    background-color: #d4edda;
    color: #155724;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

Why: This CSS file provides a clean, professional appearance for our registration system with responsive design and user-friendly styling.

5. Running the Application

5.1 Start the Flask Server

In your terminal, navigate to your project directory and run:

python app.py

Why: This command starts the Flask development server, making your registration system accessible at http://127.0.0.1:5000

5.2 Test the Registration System

Open your web browser and visit http://127.0.0.1:5000. You should see the homepage with a registration link. Click it to test the registration form functionality.

Why: Testing ensures everything works as expected before deploying to production.

6. Enhancing the System

6.1 Add Email Validation

Update your app.py with email validation:

import re

# Add this validation function
def is_valid_email(email):
    pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
    return re.match(pattern, email) is not None

# In the register function, add:
if not is_valid_email(email):
    flash('Please enter a valid email address!')
    return redirect(url_for('register'))

Why: Proper email validation prevents registration with invalid email addresses, ensuring communication can happen with registrants.

6.2 Implement Data Persistence

For production use, replace the in-memory list with a database. Consider using SQLite or PostgreSQL with SQLAlchemy:

# Add to app.py
from flask_sqlalchemy import SQLAlchemy

app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///registrations.db'
db = SQLAlchemy(app)

# Create a model
class Registration(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(100), nullable=False)
    email = db.Column(db.String(100), nullable=False)
    event = db.Column(db.String(50), nullable=False)
    timestamp = db.Column(db.DateTime, default=datetime.utcnow)

Why: Database storage ensures registrations persist beyond server restarts and allows for proper data management.

Summary

In this tutorial, you've built a complete event registration system similar to what might power TechCrunch Disrupt 2026. You learned how to create a Flask web application with HTML templates, form handling, validation, and styling. The system includes user registration for different event types with discount information and proper error handling. While this is a simplified version, it demonstrates the core concepts needed for building real event registration systems. For production use, you'd want to add features like user authentication, payment processing, email notifications, and database persistence.

Related Articles