my-cloud-devops-consulting 0.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
app.py
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
from flask import Flask, render_template, request, redirect, url_for, session, flash
|
2
|
+
from pymongo import MongoClient
|
3
|
+
from werkzeug.security import generate_password_hash, check_password_hash
|
4
|
+
from urllib.parse import quote_plus
|
5
|
+
import os
|
6
|
+
|
7
|
+
app = Flask(__name__)
|
8
|
+
app.secret_key = os.environ.get('SECRET_KEY', 'your_secret_key') # Secure your secret key with an environment variable
|
9
|
+
|
10
|
+
# MongoDB Configuration with properly escaped credentials
|
11
|
+
username = quote_plus("betrand1999") # add username and pst
|
12
|
+
password = quote_plus("Cameroon@10K")
|
13
|
+
client = MongoClient(f"mongodb+srv://{username}:{password}@cluster.7plpy.mongodb.net/my-database?retryWrites=true&w=majority")
|
14
|
+
db = client['my-database'] # Specify your database as shown in the MongoDB Atlas interface
|
15
|
+
users_collection = db['inventory_collection'] # Collection for storing user data
|
16
|
+
|
17
|
+
@app.route('/')
|
18
|
+
def home():
|
19
|
+
video_url = None
|
20
|
+
if 'username' in session:
|
21
|
+
video_url = None # Removed S3 video URL
|
22
|
+
return render_template('index.html', video_url=video_url)
|
23
|
+
|
24
|
+
@app.route('/login', methods=['GET', 'POST'])
|
25
|
+
def login():
|
26
|
+
if request.method == 'POST':
|
27
|
+
username = request.form['username']
|
28
|
+
password = request.form['password']
|
29
|
+
user = users_collection.find_one({'username': username})
|
30
|
+
if user and check_password_hash(user['password'], password):
|
31
|
+
session['username'] = username
|
32
|
+
flash('Login successful', 'success')
|
33
|
+
return redirect(url_for('home'))
|
34
|
+
else:
|
35
|
+
flash('Invalid username or password', 'error')
|
36
|
+
return redirect(url_for('login'))
|
37
|
+
return render_template('login.html')
|
38
|
+
|
39
|
+
@app.route('/register', methods=['GET', 'POST'])
|
40
|
+
def register():
|
41
|
+
if request.method == 'POST':
|
42
|
+
username = request.form['username']
|
43
|
+
password = request.form['password']
|
44
|
+
|
45
|
+
# Check if the user already exists
|
46
|
+
existing_user = users_collection.find_one({'username': username})
|
47
|
+
if existing_user:
|
48
|
+
flash('Username already exists. Please choose a different username.', 'error')
|
49
|
+
return redirect(url_for('register'))
|
50
|
+
|
51
|
+
# Hash the password for security
|
52
|
+
hashed_password = generate_password_hash(password)
|
53
|
+
user_data = {'username': username, 'password': hashed_password}
|
54
|
+
users_collection.insert_one(user_data)
|
55
|
+
flash('Successfully registered! Please log in.', 'success')
|
56
|
+
return redirect(url_for('login'))
|
57
|
+
return render_template('register.html')
|
58
|
+
|
59
|
+
@app.route('/services')
|
60
|
+
def services():
|
61
|
+
return render_template('services.html')
|
62
|
+
|
63
|
+
@app.route('/contact-form', methods=['GET', 'POST'])
|
64
|
+
def contact_form():
|
65
|
+
if request.method == 'POST':
|
66
|
+
name = request.form['name']
|
67
|
+
email = request.form['email']
|
68
|
+
phone = request.form['phone']
|
69
|
+
category = request.form['category']
|
70
|
+
appointment = request.form.get('appointment')
|
71
|
+
message = request.form['message']
|
72
|
+
|
73
|
+
# Store the contact data in the database
|
74
|
+
contact_data = {
|
75
|
+
'name': name,
|
76
|
+
'email': email,
|
77
|
+
'phone': phone,
|
78
|
+
'category': category,
|
79
|
+
'appointment': appointment,
|
80
|
+
'message': message
|
81
|
+
}
|
82
|
+
db.contacts.insert_one(contact_data)
|
83
|
+
|
84
|
+
# Remove the email or SMS notification logic here
|
85
|
+
# Simply flash a success message
|
86
|
+
flash('Your message has been submitted successfully!', 'success')
|
87
|
+
|
88
|
+
return redirect(url_for('home'))
|
89
|
+
return render_template('contact-form.html')
|
90
|
+
|
91
|
+
if __name__ == '__main__':
|
92
|
+
app.run(debug=True, host='0.0.0.0', port=80)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Metadata-Version: 2.2
|
2
|
+
Name: my-cloud-devops-consulting
|
3
|
+
Version: 0.0.0
|
4
|
+
Summary: This is my consulting website for Cloud & DevOps services.
|
5
|
+
Home-page: https://github.com/Betrand1999/project-root
|
6
|
+
Author: Betrand Mutagha
|
7
|
+
Author-email: mmutagha@gmail.com
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
11
|
+
Classifier: Operating System :: OS Independent
|
12
|
+
Requires-Python: >=3.6
|
13
|
+
Description-Content-Type: text/markdown
|
14
|
+
Requires-Dist: Flask>=2.0
|
15
|
+
Requires-Dist: pymongo
|
16
|
+
Requires-Dist: werkzeug
|
17
|
+
Requires-Dist: requests
|
18
|
+
Dynamic: author
|
19
|
+
Dynamic: author-email
|
20
|
+
Dynamic: classifier
|
21
|
+
Dynamic: description
|
22
|
+
Dynamic: description-content-type
|
23
|
+
Dynamic: home-page
|
24
|
+
Dynamic: requires-dist
|
25
|
+
Dynamic: requires-python
|
26
|
+
Dynamic: summary
|
27
|
+
|
28
|
+
sudo systemctl restart sshd
|
29
|
+
3.235.142.37:8443 # rancher
|
30
|
+
8wf8vg9lwfzddtccxwc6gqw8mzlv7j422t7dfdlt6nqcwn7rjndmk6
|
@@ -0,0 +1,5 @@
|
|
1
|
+
app.py,sha256=NbUVDgVzJzzYQqvC9ejcLZWgoATN3E82hByqyeIK2Xk,3612
|
2
|
+
my_cloud_devops_consulting-0.0.0.dist-info/METADATA,sha256=sXhG00J0bx4rnMSfah66fG0vrKZS1dfsvs4HdB3b0Eo,917
|
3
|
+
my_cloud_devops_consulting-0.0.0.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
4
|
+
my_cloud_devops_consulting-0.0.0.dist-info/top_level.txt,sha256=io9g7LCbfmTG1SFKgEOGXmCFB9uMP2H5lerm0HiHWQE,4
|
5
|
+
my_cloud_devops_consulting-0.0.0.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
app
|