On 2019-05-23 06:22, Jakub Jiřička wrote:
> I want to ask you if someone has solved how to prove that is
> possible the applications in one project run in different
> subdomains?
>
> I have 1 project (
projekt.cz) and provide of 3 applications (app1,
> app2, app3) and I would like to get on my vps (CentOS, Apache,
> PostgreSQL, Django)
app1.projekt.cz app2.projekt.cz and
>
app3.projekt.cz
I can read two interpretations of what what you describe:
1) each application is distinct/independent and you want each one to
run on its own subdomain. This seems like the most sensible
interpretation and is fairly straightforward: you configure your
web server (apache, from your description) to farm out different
subdomains:
<VirtualHost *:80>
ServerName
app1.example.com
DocumentRoot /var/www/vhosts/app1
WSGIScriptAlias / /var/www/vhosts/app1/myproject1/wsgi.py
⋮
</VirtualHost>
<VirtualHost *:80>
ServerName
app2.example.com
DocumentRoot /var/www/vhosts/app2
WSGIScriptAlias / /var/www/vhosts/app2/myproject2/wsgi.py
⋮
</VirtualHost>
with the relevant configuration in each block.
2) if you want to run the same Django code, backing multiple
subdomains with the same codebase, you want a wildcard subdomain
pointed at
<VirtualHost *:80>
ServerAlias *.
example.com
⋮
</VirtualHost>
and then sniff the Host: HTTP header which something like
django-subdomains helps to make easier.
> I searched everywhere and I found only django-subdomains and
> django-domains ... unfortunately, I have not managed to get
> started, because out-of-date
I'm not sure what you mean by "because out-of-date". While
they both appear to have been last updated in 2016, I imagine they
got to the point where they just worked and didn't need much more
care & feeding. I'd assume they're fine unless you hit an issue with
them.
-tkc