my-cloud-devops-consulting 0.1.0__py3-none-any.whl → 0.1.2__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 +92 -0
- {my_cloud_devops_consulting-0.1.0.dist-info → my_cloud_devops_consulting-0.1.2.dist-info}/METADATA +49 -4
- my_cloud_devops_consulting-0.1.2.dist-info/RECORD +5 -0
- {my_cloud_devops_consulting-0.1.0.dist-info → my_cloud_devops_consulting-0.1.2.dist-info}/WHEEL +1 -1
- my_cloud_devops_consulting-0.1.2.dist-info/top_level.txt +1 -0
- my_cloud_devops_consulting-0.1.0.dist-info/RECORD +0 -4
- my_cloud_devops_consulting-0.1.0.dist-info/top_level.txt +0 -1
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("betrand1997")
|
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)
|
{my_cloud_devops_consulting-0.1.0.dist-info → my_cloud_devops_consulting-0.1.2.dist-info}/METADATA
RENAMED
@@ -1,12 +1,10 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: my-cloud-devops-consulting
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.2
|
4
4
|
Summary: This is my consulting website for Cloud & DevOps services.
|
5
5
|
Home-page: https://github.com/Betrand1999/project-root
|
6
6
|
Author: Betrand Mutagha
|
7
7
|
Author-email: mmutagha@gmail.com
|
8
|
-
License: UNKNOWN
|
9
|
-
Platform: UNKNOWN
|
10
8
|
Classifier: Programming Language :: Python :: 3
|
11
9
|
Classifier: Programming Language :: Python :: 3.10
|
12
10
|
Classifier: License :: OSI Approved :: MIT License
|
@@ -17,6 +15,15 @@ Requires-Dist: Flask>=2.0
|
|
17
15
|
Requires-Dist: pymongo
|
18
16
|
Requires-Dist: werkzeug
|
19
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
|
20
27
|
|
21
28
|
# Cloud & DevOps Consulting
|
22
29
|
|
@@ -98,5 +105,43 @@ pip install dist/project_root-0.1.0-py3-none-any.whl
|
|
98
105
|
pip install twine
|
99
106
|
what is twine: Twine is a utility for publishing Python packages on the Python Package Index (PyPI)
|
100
107
|
#####################################################################
|
108
|
+
twine upload dist/my_cloud_devops_consulting-0.1.1-py3-none-any.whl
|
101
109
|
|
110
|
+
#############################################################################
|
111
|
+
How route are configure in apache2
|
112
|
+
sudo vi /etc/apache2/sites-available/000-default.conf
|
102
113
|
|
114
|
+
|
115
|
+
|
116
|
+
<VirtualHost *:80>
|
117
|
+
ServerAdmin webmaster@localhost
|
118
|
+
|
119
|
+
# Default application
|
120
|
+
ProxyPreserveHost On
|
121
|
+
ProxyPass / http://localhost:8080/
|
122
|
+
ProxyPassReverse / http://localhost:8080/
|
123
|
+
|
124
|
+
# Application running on port 9090
|
125
|
+
ProxyPass /app2 http://localhost:9090/
|
126
|
+
ProxyPassReverse /app2 http://localhost:9090/
|
127
|
+
|
128
|
+
# Logging
|
129
|
+
ErrorLog ${APACHE_LOG_DIR}/error.log
|
130
|
+
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
131
|
+
</VirtualHost>
|
132
|
+
|
133
|
+
|
134
|
+
# Enable both configurations and restart Apache:
|
135
|
+
|
136
|
+
bash
|
137
|
+
Copy code
|
138
|
+
sudo a2ensite app1.conf
|
139
|
+
sudo a2ensite app2.conf
|
140
|
+
sudo systemctl restart apache2
|
141
|
+
|
142
|
+
|
143
|
+
# sudo systemctl restart apache2
|
144
|
+
|
145
|
+
####################################################
|
146
|
+
https://www.youtube.com/watch?v=3j33lNzMZlM&t=308s
|
147
|
+
####################################################
|
@@ -0,0 +1,5 @@
|
|
1
|
+
app.py,sha256=sOzd-_EfSoT9wZTg1j0Zpw8V3LBPYOjT6bPEEgWG-K8,3589
|
2
|
+
my_cloud_devops_consulting-0.1.2.dist-info/METADATA,sha256=zbGTvr_UuSjGNYMyOLBYap2aq6_lqbGmDvqCPgMuXYw,4199
|
3
|
+
my_cloud_devops_consulting-0.1.2.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
4
|
+
my_cloud_devops_consulting-0.1.2.dist-info/top_level.txt,sha256=io9g7LCbfmTG1SFKgEOGXmCFB9uMP2H5lerm0HiHWQE,4
|
5
|
+
my_cloud_devops_consulting-0.1.2.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
app
|
@@ -1,4 +0,0 @@
|
|
1
|
-
my_cloud_devops_consulting-0.1.0.dist-info/METADATA,sha256=BkENJ4nD-B9wYyPDfs8_w-LNVQRCyB3L4sAhtyqX2Sg,3012
|
2
|
-
my_cloud_devops_consulting-0.1.0.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
|
3
|
-
my_cloud_devops_consulting-0.1.0.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
4
|
-
my_cloud_devops_consulting-0.1.0.dist-info/RECORD,,
|
@@ -1 +0,0 @@
|
|
1
|
-
|