Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
add ads.txt file
Browse files Browse the repository at this point in the history
Signed-off-by: RaenonX <[email protected]>
  • Loading branch information
RaenonX committed Feb 17, 2021
1 parent 5137f99 commit 9e97cf8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
17 changes: 9 additions & 8 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,38 @@ def create_app(with_error=True, configfile=None):
Bootstrap(app)
JSGlue(app)
HerokuConfig(app, configfile)

# Register blueprints
if with_error:
app.register_blueprint(blueprints.err)
app.register_blueprint(blueprints.api)
app.register_blueprint(blueprints.frontend)
app.register_blueprint(blueprints.frontend_user)
app.register_blueprint(blueprints.dummy)

app.register_blueprint(blueprints.static)

# Configure app for flask-mail
app.config['MAIL_SERVER']='smtp.gmail.com'
app.config['MAIL_SERVER'] = 'smtp.gmail.com'
app.config['MAIL_PORT'] = 465
app.config['MAIL_USERNAME'] = os.environ["GM_EMAIL"]
app.config['MAIL_PASSWORD'] = os.environ["GM_PASSWORD"]
app.config['MAIL_USE_TLS'] = False
app.config['MAIL_USE_SSL'] = True
app.config['MAIL_DEFAULT_SENDER'] = os.environ["GM_EMAIL"]

# Set jinja cache to unlimited
# Set jinja cache to unlimited
app.jinja_env.cache = {}

# Generate secret key for forms
app.secret_key = bytes(os.environ.get("SECRET_KEY"), encoding='utf-8')

# Configure app to for bootstrap to not use CDN
app.config["BOOTSTRAP_SERVE_LOCAL"] = True

# Configure mail instance
mail = Mail(app)
app.config["MAIL_INSTANCE"] = mail

# Append nav bar to app
blueprints.nav.init_app(app)

Expand All @@ -67,7 +68,7 @@ def _proc_prevent_sleep():
if __name__ == "__main__":
if os.environ["APP_ROOT_URL"] is None:
print("Specify environment variable 'APP_ROOT_URL', or some functions will malfunction.")

activate_sleep_preventer()

app = create_app()
Expand Down
3 changes: 2 additions & 1 deletion blueprints/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
from .api import api
from .frontend_user import frontend_user
from .nav import nav
from .dummy import dummy
from .dummy import dummy
from .static import static
8 changes: 8 additions & 0 deletions blueprints/static.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from flask import Blueprint, send_from_directory

static = Blueprint("static", __name__)


@static.route("/ads.txt")
def ads_txt():
return send_from_directory("static", "ads.txt")
1 change: 1 addition & 0 deletions static/ads.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
google.com, pub-1535004092052078, DIRECT, f08c47fec0942fa0

0 comments on commit 9e97cf8

Please sign in to comment.