✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

CENTOS 7 - Dash apps with flask server a unique https server

Hello, i´ve been searching in the forums quiet a long time now. but i just can´t find the most accurate way to perform what i will describe next.

I have a centos 7 server which runs https 2.4.6. I have the following httpd.conf files

<VirtualHost *:80>
DocumentRoot “/var/www”
ServerName localhost

# PYTHON-FLASK
WSGIDaemonProcess p2_f python-path=/path_to_site_flask/ambiente/lib/python3.5/site-packages
WSGIScriptAlias /appdash1 /path_to_site_flask/p2_f/p2.wsgi
<Directory /path_to_site_flask/p2_f>
    WSGIProcessGroup p2_f
    WSGIApplicationGroup %{GLOBAL}
	Require all granted
</Directory>

#PYTHON-DJANGO
WSGIDaemonProcess p1_f python-path=/path_to_site_django/p1_f:/path_to_site_django/ambiente/lib/python3.5/site-packages
WSGIProcessGroup p1_f
WSGIScriptAlias / /path_to_site_django/p1_f/p1/wsgi.py	
Alias /static /path_to_site_django/p1_f/static
<Directory /path_to_site_django/p1_f/static>
    Require all granted
</Directory>

<Directory /path_to_site_django/p1_f/p1>
	<Files wsgi.py>
		Require all granted
    </Files>
</Directory>

Here you can notice that i have a django configuration and a flask configuration. I first put the flask cause i am using the “/appdash1/” as prefix in the url for the flask. As for django just using “/”. With this i can direct to flask when using “IP/appdash1/anything” urls. Any other ips works with the django urls motor.

With this conf i can easily use flask and django in the same https server. I have testing. BUT! when incluide DASH to the flask server there is something difficult when trying many apps. One is no problem cause i do:

server=Flask(name)
app=dash.Dash(name=name,server=server)
app.config.update({
‘routes_pathname_prefix’:’/’,
‘requests_pathname_prefix’:’/appdash1/’
})

BUT! i want multiple app to deploy in the same flask server using dash…

something like:

IP/appdash1/app1
IP/appdash1/app2
IP/appdash1/app3

I made the mod_wsgi connection between Flask and Http in centos so i understand this will attend the multiple user service.

Ive try https://dash.plot.ly/urls and many other threats where this is refered.

I may wanna do something like this

apps
–app1
----aplication.py
–app2
----aplication.py
server.py
project.py
project.wsgi

but get many error loading layout…

any comments? is there any place where i can follow some guidance to accomplish this? ive seen @chriddyp to do some changes in topics realted to this… any comments man?

thanks

I was testing more and more, and seems to be that i got a huge mistake while creating the index.py file. I was importing apps.app1.aplication.py before creating the server… so… after that it was all great.

1 Like