Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from flask import Flask, render_template, request, redirect, url_for
|
| 2 |
+
|
| 3 |
+
app = Flask(__name__)
|
| 4 |
+
|
| 5 |
+
# Route to render signup page
|
| 6 |
+
@app.route('/')
|
| 7 |
+
def signup_form():
|
| 8 |
+
return render_template('signup.html')
|
| 9 |
+
|
| 10 |
+
# Route to handle signup form submission
|
| 11 |
+
@app.route('/signup', methods=['POST'])
|
| 12 |
+
def signup():
|
| 13 |
+
username = request.form['username']
|
| 14 |
+
email = request.form['email']
|
| 15 |
+
password = request.form['password']
|
| 16 |
+
confirm_password = request.form['confirm_password']
|
| 17 |
+
|
| 18 |
+
# Simple validation
|
| 19 |
+
if password != confirm_password:
|
| 20 |
+
return "Passwords do not match. Please try again."
|
| 21 |
+
|
| 22 |
+
# Here, you would typically add code to store the user's data in a database
|
| 23 |
+
|
| 24 |
+
return f"Account for {username} created successfully!"
|
| 25 |
+
|
| 26 |
+
if __name__ == '__main__':
|
| 27 |
+
app.run(debug=True)
|