MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / create_app

Function create_app

web/pgadmin/__init__.py:186–990  ·  view source on GitHub ↗
(app_name=None)

Source from the content-addressed store, hash-verified

184
185
186def create_app(app_name=None):
187 # Configuration settings
188 import config
189 if not app_name:
190 app_name = config.APP_NAME
191
192 # Check if app is created for CLI operations or Web
193 cli_mode = False
194 if app_name.endswith('-cli'):
195 cli_mode = True
196
197 # Only enable password related functionality in server mode.
198 if config.SERVER_MODE is True:
199 # Some times we need to access these config params where application
200 # context is not available (we can't use current_app.config in those
201 # cases even with current_app.app_context())
202 # So update these params in config itself.
203 # And also these updated config values will picked up by application
204 # since we are updating config before the application instance is
205 # created.
206
207 config.SECURITY_RECOVERABLE = True
208 config.SECURITY_CHANGEABLE = True
209 # Now we'll open change password page in dialog
210 # we don't want it to redirect to main page after password
211 # change operation so we will open the same password change page again.
212 config.SECURITY_POST_CHANGE_VIEW = 'browser.change_password'
213
214 """Create the Flask application, startup logging and dynamically load
215 additional modules (blueprints) that are found in this directory."""
216 app = PgAdmin(__name__, static_url_path='/static')
217 # Removes unwanted whitespace from render_template function
218 app.jinja_env.trim_blocks = True
219 app.config.from_object(config)
220 app.config.update(dict(PROPAGATE_EXCEPTIONS=True))
221
222 config.SETTINGS_SCHEMA_VERSION = CURRENT_SCHEMA_VERSION
223 ##########################################################################
224 # Setup logging and log the application startup
225 ##########################################################################
226
227 # We won't care about errors in the logging system, we are more
228 # interested in application errors.
229 logging.raiseExceptions = False
230
231 # Add SQL level logging, and set the base logging level
232 logging.addLevelName(25, 'SQL')
233 app.logger.setLevel(logging.DEBUG)
234 app.logger.handlers = []
235
236 # We also need to update the handler on the webserver in order to see
237 # request. Setting the level prevents werkzeug from setting up it's own
238 # stream handler thus ensuring all the logging goes through the pgAdmin
239 # logger.
240 logger = logging.getLogger('werkzeug')
241 logger.setLevel(config.CONSOLE_LOG_LEVEL)
242
243 # Set SQLITE_PATH to TEST_SQLITE_PATH while running test cases

Callers 15

dump_serversMethod · 0.90
load_serversMethod · 0.90
get_roleMethod · 0.90
load_usersMethod · 0.90
delete_userMethod · 0.90
update_userMethod · 0.90
get_users_from_dbMethod · 0.90
update_external_userMethod · 0.90
create_userMethod · 0.90
get_userMethod · 0.90
get_userMethod · 0.90
fetch_prefsMethod · 0.90

Calls 15

register_logout_hookMethod · 0.95
normalize_database_uriFunction · 0.90
delete_adhoc_serversFunction · 0.90
create_session_interfaceFunction · 0.90
KeyManagerClass · 0.90
PgAdminClass · 0.85
gettextFunction · 0.85
get_submodulesFunction · 0.85
infoMethod · 0.80
init_appMethod · 0.80

Tested by 1

runTestMethod · 0.72