How can I link a static page to a subdomain on the Apps Platform?

I want to prefix this by mentioning that I’m very new to development, and this is a “learning project” for me, so my question might be dumb.

I’m currently using the app platform to host a Flask website. I have a custom domain linked via a flattened CNAME record. I’ve added the subdomain for via another CNAME record.

Usually, with Flask, I would do the following to load the root page for a subdomain:

@app.route('/', subdomain="api")
def api_load():
    return render_template("page.html")

When visiting the site using the subdomain, flask does not acknowledge it, instead just displaying the default root page.

I think that my issue is being caused by using a CNAME record, however, I can’t reliably see a way to use an A record because I can’t find a static IP for my app.

The only other solution I can see is to create another separate app, and just redirect the subdomain to that instead, but this would double my costs and I’m not eager to do that.

Am I missing something, or is this feature simply not available on the apps platform?

Thanks in advance for your time.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Sri Charan Madhavapeddi
DigitalOcean Employee
DigitalOcean Employee badge
August 21, 2023

App Platform does not support a persistent IP address at this moment. You will handle this by the CNAME record and update the value of CNAME with the APP’s URL.

Refer to below link for more details on Domains:

Hope this helps!

Cheers, Sri Charan

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel