Use auth-module and log-file from pn.serve


I am trying to use the auth-module and log-file from pn.serve to be invoked with python

the is copied from

If I run the app

import panel as pn 
def get_page1():
    return 'hola'


panel serve --show --autoreload --rest-session-info -session-history=-1 --log-file='log_panel'

It works perfectly the auth module and the log file is written to the specified file. If i use the pn.serve running inside a python script with ‘python’

import panel as pn 
def get_page1():
    return 'hola'

rest_session_info=True,auth_module='', log_file='log_panel')

the app runs, but the auth and the log file do not work.

If someone is using them I would be very gratefull for the help.


Did you find a solution to this? Am also trying to use the bokeh example with the pn.serve inside the app’s python script and am having the same issue where the auth file doesn’t work.

to make it working from pn.serve and running python I did not find a solution yet, but it works if you make your app.servable() and you run “panel serve --show --autoreload --rest-session-info -session-history=-1 --log-file=‘log_panel’” with the auth module enabled.

I think some options in the docs should be clearly explicited how to call them when using in panel serve and when in pn.serve.

for auth_module, you can use

from bokeh.server.auth_provider import AuthModule
 server = pn.serve(