1

I have a decoupled application in which the frontend is in Vuejs (SPA) and the REST backend in Python/Django.

For cost reasons, I would like to deploy both of them in the same Heroku app. Is it possible?

I've been reading about the Procfile but I'm not sure it allow me achieve it.

Thanks

2 Answers 2

1

Just serve the static files from django.

For example, in your vue.config.js:

module.exports = {
    publicPath: '/',
    outputDir: "dist",
    assetsDir: "static",
    indexPath: "spa.html",
    css: {extract: false}

}

In django urls.py:

urlpatterns = [
    re_path(r'^app/*', TemplateView.as_view(
        template_name='spa.html',
        extra_context=SPA_CONTEXT,
    )),
]

And remember to add the static assets and template folders in your settings.py.

Sign up to request clarification or add additional context in comments.

1 Comment

Awesome! Thank you
0

Yes, it is very much possible.

I found some documented help by a simple google search. You can refer to these links -

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.