from flask import Flask
from logging import getLogger, INFO
from pystil.log import get_default_handler
from pystil.routes import register_common_routes
from pystil.routes.data import register_data_routes


def app():
    """Create Flask app"""
    app = Flask(__name__)
    handler = get_default_handler()
    getLogger('werkzeug').addHandler(handler)
    getLogger('werkzeug').setLevel(INFO)
    app.logger.handlers = []
    app.logger.addHandler(handler)
    register_common_routes(app)
    register_data_routes(app)
    return app

from flask import Flask
from logging import getLogger, INFO
from pystil.log import get_default_handler
from pystil.routes import register_common_routes
from pystil.routes.data import register_data_routes
import pystil
import os


def app():
    """Create Flask app"""
    root = os.path.dirname(pystil.__file__)
    static_folder = os.path.join(root, 'static')
    template_folder = os.path.join(root, 'templates')
    app = Flask(__name__,
                static_folder=static_folder, template_folder=template_folder)
    handler = get_default_handler()
    getLogger('werkzeug').addHandler(handler)
    getLogger('werkzeug').setLevel(INFO)
    app.logger.handlers = []
    app.logger.addHandler(handler)
    register_common_routes(app)
    register_data_routes(app)
    return app

Use __file__ for static and templates
Use __file__ for static and templates

  from flask import Flask
  from logging import getLogger, INFO
  from pystil.log import get_default_handler
  from pystil.routes import register_common_routes
  from pystil.routes.data import register_data_routes
+ import pystil
+ import os
  
  
  def app():
      """Create Flask app"""
+     root = os.path.dirname(pystil.__file__)
+     static_folder = os.path.join(root, 'static')
+     template_folder = os.path.join(root, 'templates')
-     app = Flask(__name__)
+     app = Flask(__name__,
+                 static_folder=static_folder, template_folder=template_folder)
      handler = get_default_handler()
      getLogger('werkzeug').addHandler(handler)
      getLogger('werkzeug').setLevel(INFO)
      app.logger.handlers = []
      app.logger.addHandler(handler)
      register_common_routes(app)
      register_data_routes(app)
      return app
  
Use __file__ for static and templates
## Code Before:
from flask import Flask
from logging import getLogger, INFO
from pystil.log import get_default_handler
from pystil.routes import register_common_routes
from pystil.routes.data import register_data_routes


def app():
    """Create Flask app"""
    app = Flask(__name__)
    handler = get_default_handler()
    getLogger('werkzeug').addHandler(handler)
    getLogger('werkzeug').setLevel(INFO)
    app.logger.handlers = []
    app.logger.addHandler(handler)
    register_common_routes(app)
    register_data_routes(app)
    return app

## Instruction:
Use __file__ for static and templates
## Code After:
from flask import Flask
from logging import getLogger, INFO
from pystil.log import get_default_handler
from pystil.routes import register_common_routes
from pystil.routes.data import register_data_routes
import pystil
import os


def app():
    """Create Flask app"""
    root = os.path.dirname(pystil.__file__)
    static_folder = os.path.join(root, 'static')
    template_folder = os.path.join(root, 'templates')
    app = Flask(__name__,
                static_folder=static_folder, template_folder=template_folder)
    handler = get_default_handler()
    getLogger('werkzeug').addHandler(handler)
    getLogger('werkzeug').setLevel(INFO)
    app.logger.handlers = []
    app.logger.addHandler(handler)
    register_common_routes(app)
    register_data_routes(app)
    return app
