Updated packages. Added new session type
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
FROM python:3.12-bullseye
|
||||
FROM python:3.13.3-bullseye
|
||||
|
||||
ENV PYTHONFAULTHANDLER=1
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ app.config['SECRET_KEY'] = ApplicationConfig.SECRET_KEY
|
||||
session.configure(bind=ApplicationConfig.SQLALCHEMY_DATABASE_URI)
|
||||
db = SQLAlchemy(app)
|
||||
bcrypt = Bcrypt(app)
|
||||
app.config['SESSION_SQLALCHEMY'] = db
|
||||
server_session = Session(app)
|
||||
ma = Marshmallow(app)
|
||||
mail = Mail(app)
|
||||
|
||||
@@ -19,8 +19,15 @@ import string
|
||||
import random
|
||||
|
||||
|
||||
def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
|
||||
return ''.join(random.choice(chars) for _ in range(size))
|
||||
def generate_random_number_string(length):
|
||||
# Ensure the length is at least 1
|
||||
if length < 1:
|
||||
raise ValueError("Length must be at least 1")
|
||||
|
||||
# Generate a random number with the specified length
|
||||
random_number = ''.join(random.choices(string.digits, k=length))
|
||||
|
||||
return random_number
|
||||
|
||||
|
||||
|
||||
@@ -143,24 +150,31 @@ def create_customer():
|
||||
.query(Admin_Company)
|
||||
.filter(Admin_Company.id == 1)
|
||||
.first())
|
||||
last_customer = (db.session
|
||||
.query(Customer_Customer)
|
||||
.order_by(Customer_Customer.id.desc())
|
||||
.first())
|
||||
|
||||
get_company = (db.session
|
||||
.query(Admin_Company)
|
||||
.filter(Admin_Company.id == 1)
|
||||
.first())
|
||||
|
||||
|
||||
random_string = generate_random_number_string(6)
|
||||
|
||||
made_account_number = str(get_company.account_prefix) + '-' + str(random_string)
|
||||
see_if_exists = (db.session.query(Customer_Customer).filter(Customer_Customer.account_number == made_account_number).first())
|
||||
|
||||
new_customer_id = last_customer.id + 1
|
||||
if len(str(new_customer_id)) == 2:
|
||||
new_customer_id = '000' + str(new_customer_id)
|
||||
if len(str(new_customer_id)) == 3:
|
||||
new_customer_id = '00' + str(new_customer_id)
|
||||
if len(str(new_customer_id)) == 4:
|
||||
new_customer_id = '0' + str(new_customer_id)
|
||||
if see_if_exists is not None:
|
||||
|
||||
starter_digits = str(get_company.account_prefix) + '-' + str(new_customer_id)
|
||||
random_string = generate_random_number_string(10)
|
||||
|
||||
made_account_number = str(get_company.account_prefix) + '-' + str(random_string)
|
||||
see_if_exists = (db.session.query(Customer_Customer).filter(Customer_Customer.account_number == made_account_number).first())
|
||||
|
||||
made_account_number = starter_digits
|
||||
if see_if_exists is not None:
|
||||
|
||||
random_string = generate_random_number_string(10)
|
||||
|
||||
made_account_number = str(get_company.account_prefix) + '-' + str(random_string)
|
||||
see_if_exists = (db.session.query(Customer_Customer).filter(Customer_Customer.account_number == made_account_number).first())
|
||||
|
||||
response_customer_last_name = request.json["customer_last_name"]
|
||||
response_customer_first_name = request.json["customer_first_name"]
|
||||
|
||||
@@ -136,6 +136,8 @@ def get_customer_past_delivery1(customer_id):
|
||||
get_customer_past_delivery = (db.session
|
||||
.query(Delivery_Delivery)
|
||||
.filter(Delivery_Delivery.customer_id == customer_id)
|
||||
.filter(Delivery_Delivery.delivery_status == 10)
|
||||
.order_by(Delivery_Delivery.id.desc())
|
||||
.limit(5))
|
||||
|
||||
delivery_schema = Delivery_Delivery_schema(many=True)
|
||||
@@ -148,6 +150,8 @@ def get_customer_past_delivery2(customer_id):
|
||||
get_customer_past_delivery = (db.session
|
||||
.query(Delivery_Delivery)
|
||||
.filter(Delivery_Delivery.customer_id == customer_id)
|
||||
|
||||
.order_by(Delivery_Delivery.id.desc())
|
||||
.offset(5)
|
||||
.limit(5))
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import redis
|
||||
|
||||
|
||||
class ApplicationConfig:
|
||||
@@ -33,6 +32,8 @@ class ApplicationConfig:
|
||||
SECRET_KEY = "youwillneverguessthiskeycia"
|
||||
|
||||
# sessions
|
||||
# Available SESSION_TYPE options: 'redis', 'sqlalchemy', 'mongodb', 'filesystem', 'memcached'
|
||||
SESSION_TYPE = "sqlalchemy"
|
||||
SESSION_COOKIE_NAME = "eamco_session"
|
||||
SESSION_COOKIE_SECURE = False
|
||||
SESSION_COOKIE_HTTPONLY = True
|
||||
@@ -50,5 +51,3 @@ class ApplicationConfig:
|
||||
CORS_ALLOW_HEADERS = "*"
|
||||
CORS_ORIGIN_WHITELIST = ['*']
|
||||
WHITE = ['*']
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import redis
|
||||
|
||||
|
||||
class ApplicationConfig:
|
||||
|
||||
@@ -1,20 +1,35 @@
|
||||
flask==2.3.3
|
||||
flask_sqlalchemy
|
||||
flask_session==0.5.0
|
||||
flask-login==0.6.3
|
||||
flask-moment
|
||||
flask-paranoid
|
||||
flask-bcrypt
|
||||
flask-cors
|
||||
flask_marshmallow
|
||||
gunicorn
|
||||
python-dateutil
|
||||
python-dotenv
|
||||
marshmallow-sqlalchemy
|
||||
psycopg2-binary
|
||||
redis
|
||||
sqlalchemy
|
||||
flask_wtf
|
||||
flask_mail
|
||||
Werkzeug==2.3.8
|
||||
geopy
|
||||
bcrypt==4.3.0
|
||||
blinker==1.9.0
|
||||
cachelib==0.13.0
|
||||
click==8.1.8
|
||||
Flask==3.1.0
|
||||
Flask-Bcrypt==1.0.1
|
||||
flask-cors==5.0.1
|
||||
Flask-Login==0.6.3
|
||||
Flask-Mail==0.10.0
|
||||
flask-marshmallow==1.3.0
|
||||
Flask-Moment==1.0.6
|
||||
Flask-Paranoid==0.3.0
|
||||
Flask-Session==0.8.0
|
||||
Flask-SQLAlchemy==3.1.1
|
||||
Flask-WTF==1.2.2
|
||||
geographiclib==2.0
|
||||
geopy==2.4.1
|
||||
greenlet==3.2.2
|
||||
gunicorn==23.0.0
|
||||
itsdangerous==2.2.0
|
||||
Jinja2==3.1.6
|
||||
MarkupSafe==3.0.2
|
||||
marshmallow==4.0.0
|
||||
marshmallow-sqlalchemy==1.4.2
|
||||
msgspec==0.19.0
|
||||
packaging==25.0
|
||||
psycopg2-binary==2.9.10
|
||||
python-dateutil==2.9.0.post0
|
||||
python-dotenv==1.1.0
|
||||
redis==6.0.0
|
||||
six==1.17.0
|
||||
SQLAlchemy==2.0.40
|
||||
typing_extensions==4.13.2
|
||||
Werkzeug==3.1.3
|
||||
WTForms==3.2.1
|
||||
|
||||
20
requirements.txt.bak
Executable file
20
requirements.txt.bak
Executable file
@@ -0,0 +1,20 @@
|
||||
flask==2.3.3
|
||||
flask_sqlalchemy
|
||||
flask_session==0.5.0
|
||||
flask-login==0.6.3
|
||||
flask-moment
|
||||
flask-paranoid
|
||||
flask-bcrypt
|
||||
flask-cors
|
||||
flask_marshmallow
|
||||
gunicorn
|
||||
python-dateutil
|
||||
python-dotenv
|
||||
marshmallow-sqlalchemy
|
||||
psycopg2-binary
|
||||
redis
|
||||
sqlalchemy
|
||||
flask_wtf
|
||||
flask_mail
|
||||
Werkzeug==2.3.8
|
||||
geopy
|
||||
13
update_requirements.sh
Executable file
13
update_requirements.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
# Script to update pip packages and regenerate requirements.txt
|
||||
|
||||
# Extract package names from requirements.txt, removing version specifiers
|
||||
packages=$(cat requirements.txt | sed 's/==.*//' | sed 's/<.*//' | sed 's/>.*//' | tr '\n' ' ')
|
||||
|
||||
# Upgrade all packages
|
||||
pip3 install --upgrade $packages
|
||||
|
||||
# Regenerate requirements.txt with the new versions
|
||||
pip3 freeze > requirements.txt
|
||||
|
||||
echo "Requirements updated successfully."
|
||||
Reference in New Issue
Block a user