Migrating a code written in flask framework to django.

1,570 views
Skip to first unread message

GEETHANJALI S P

unread,
Mar 12, 2021, 6:51:29 PM3/12/21
to django...@googlegroups.com
Hi all,
Suppose a program is written in flask framework how can we convert it into django?
Thanks in advance.

cosmos multi

unread,
Mar 12, 2021, 7:38:51 PM3/12/21
to django...@googlegroups.com
I don't know of any tool that allows you to do a technology migration automatically, you have to change the code slowly yourself.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMKAcOJQZ5jM7vHScUTUhj7iANW2M-v0AJtcfSWnynsCsXpbEA%40mail.gmail.com.

Ernest Thuku

unread,
Mar 12, 2021, 7:44:28 PM3/12/21
to Django users
I don't think there is a proper way to convert flak to Django but if you know how python well you can rewrite from flask to Django its not that difficult. This will happen if atleast you know how to work with Django.

--

Kasper Laudrup

unread,
Mar 12, 2021, 8:08:44 PM3/12/21
to django...@googlegroups.com
On 12/03/2021 19.50, GEETHANJALI S P wrote:
> Suppose a program is written in flask framework how can we convert it
> into django?

That depends so much on the program that there's no way to answer that.

Flask basically just makes it easy to handle HTTP requests in Python.
While Django does that, it does so much more as well.

I've personally used Flask for tasks where Django would simply be
overkill since I didn't need a database or a template rendering engine.
An example for that could be a very simple REST service.

If your existing Flask application doesn't use a database, doesn't need
to generate dynamic HTML pages or any of the other stuff that Django
provides, then it would probably be fairly trivial. The question would
then be what would be the point of converting it to Django in the first
place?

If your existing Flask application does use a database etc. and is more
of a reimplementation of at least some of the features Django provides
out of the box, then I could imagine it would be far from trivial, but
might make sense, again of course depending on the application.

It would be easier to give an answer if you could share the code to the
Flask application or at least describe it a bit more in detail.

Kind regards,

Kasper Laudrup

GEETHANJALI S P

unread,
Mar 13, 2021, 5:04:04 AM3/13/21
to django...@googlegroups.com
Hi..

This is the link of flask code....I wanted to change this to django..How to do that..?



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

Kasper Laudrup

unread,
Mar 13, 2021, 10:14:50 AM3/13/21
to django...@googlegroups.com
On 13/03/2021 06.02, GEETHANJALI S P wrote:
> Hi..
> https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Python <https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Python>
>

I see. This looks like some sample code intended to be used for
inspiration on how to integrate PowerBI with your Python project. I've
never heard of PowerBI before though.

> This is the link of flask code....I wanted to change this to django..How
> to do that..?
>

There's no step-by-step guide on how to do things like that. It's not
trivial to do but any reasonably experienced developer should be able to
do it.

I would probably start with an "empty" Django project and then try to
see if I could break it down into steps, e.g. starting by writing some
unittests for how you would expect your models to behave based on the
sample code you linked to, then implement until your tests pass. Then
move on to views etc. Something like that.

That's how I think *I* would do it, but that doesn't mean it's the
correct way and I would probably only know after I had actually started
writing some code.

What are you really trying to achieve though?

Anyway, if you start to write some code and face some issues feel free
to ask for help here. I'm sure someone will try to guide you.

Good luck.

Kind regards,

Kasper Laudrup
Reply all
Reply to author
Forward
0 new messages