Hi James, I'm going to build a separated instance to provide only REST services to be consumed by Project A. It's ok to use the same views to provide a REST interface in API but in this case I need to remove models from project A, right?
Thank you very much! Em domingo, 16 de agosto de 2015 20:13:37 UTC-3, James Schneider escreveu: > > Are you adding REST functionality to an existing project? Or will you be > using a separate instance to provide only REST services and maintain two > different code bases? > > I believe you can use the django-rest-framework to utilize the same views > (literally) to provide a REST interface, so you may not need to rewrite or > copy anything, just add a few bits of code to make your views aware of > incoming REST requests, some URL additions, and serializers for your > models. > > http://www.django-rest-framework.org/ > > -James > On Aug 16, 2015 3:59 PM, <[email protected] <javascript:>> wrote: > >> Hey guys, >> >> I have a question about an architectural issue and I would like to hear >> some suggestions about it. >> >> I created a project using Django (let's call this Project A) and now I >> decided to start a new one but this time it is an API using Django REST. >> So, for now I have to refactor Project A to consume data from API, but in >> order to do that I need to duplicate all my models files in both projects. >> The question is how can I avoid this? Is there another way to do that? >> >> I see that *moving models *from Project A to API as something natural >> but to have an empty models file in Project A I need to change some >> concepts, for removing ModelForms and put all validation logic using Form. >> >> How do you guys see this? Would you recommend something different? Is >> that a good idea? >> >> 1. Project A (Models) <---> API (same models??? How can I handle >> that?) >> 2. Project A (No models) <---> API (Models) >> >> Thanks in advance! >> >> -- >> 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 [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/11d2f88e-a159-4e7b-903f-80d0f6e8e74a%40googlegroups.com >> >> <https://groups.google.com/d/msgid/django-users/11d2f88e-a159-4e7b-903f-80d0f6e8e74a%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > Em domingo, 16 de agosto de 2015 20:13:37 UTC-3, James Schneider escreveu: > > Are you adding REST functionality to an existing project? Or will you be > using a separate instance to provide only REST services and maintain two > different code bases? > > I believe you can use the django-rest-framework to utilize the same views > (literally) to provide a REST interface, so you may not need to rewrite or > copy anything, just add a few bits of code to make your views aware of > incoming REST requests, some URL additions, and serializers for your > models. > > http://www.django-rest-framework.org/ > > -James > On Aug 16, 2015 3:59 PM, <[email protected] <javascript:>> wrote: > >> Hey guys, >> >> I have a question about an architectural issue and I would like to hear >> some suggestions about it. >> >> I created a project using Django (let's call this Project A) and now I >> decided to start a new one but this time it is an API using Django REST. >> So, for now I have to refactor Project A to consume data from API, but in >> order to do that I need to duplicate all my models files in both projects. >> The question is how can I avoid this? Is there another way to do that? >> >> I see that *moving models *from Project A to API as something natural >> but to have an empty models file in Project A I need to change some >> concepts, for removing ModelForms and put all validation logic using Form. >> >> How do you guys see this? Would you recommend something different? Is >> that a good idea? >> >> 1. Project A (Models) <---> API (same models??? How can I handle >> that?) >> 2. Project A (No models) <---> API (Models) >> >> Thanks in advance! >> >> -- >> 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 [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/11d2f88e-a159-4e7b-903f-80d0f6e8e74a%40googlegroups.com >> >> <https://groups.google.com/d/msgid/django-users/11d2f88e-a159-4e7b-903f-80d0f6e8e74a%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > Em domingo, 16 de agosto de 2015 20:13:37 UTC-3, James Schneider escreveu: > > Are you adding REST functionality to an existing project? Or will you be > using a separate instance to provide only REST services and maintain two > different code bases? > > I believe you can use the django-rest-framework to utilize the same views > (literally) to provide a REST interface, so you may not need to rewrite or > copy anything, just add a few bits of code to make your views aware of > incoming REST requests, some URL additions, and serializers for your > models. > > http://www.django-rest-framework.org/ > > -James > On Aug 16, 2015 3:59 PM, <[email protected] <javascript:>> wrote: > >> Hey guys, >> >> I have a question about an architectural issue and I would like to hear >> some suggestions about it. >> >> I created a project using Django (let's call this Project A) and now I >> decided to start a new one but this time it is an API using Django REST. >> So, for now I have to refactor Project A to consume data from API, but in >> order to do that I need to duplicate all my models files in both projects. >> The question is how can I avoid this? Is there another way to do that? >> >> I see that *moving models *from Project A to API as something natural >> but to have an empty models file in Project A I need to change some >> concepts, for removing ModelForms and put all validation logic using Form. >> >> How do you guys see this? Would you recommend something different? Is >> that a good idea? >> >> 1. Project A (Models) <---> API (same models??? How can I handle >> that?) >> 2. Project A (No models) <---> API (Models) >> >> Thanks in advance! >> >> -- >> 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 [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/11d2f88e-a159-4e7b-903f-80d0f6e8e74a%40googlegroups.com >> >> <https://groups.google.com/d/msgid/django-users/11d2f88e-a159-4e7b-903f-80d0f6e8e74a%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > Em domingo, 16 de agosto de 2015 20:13:37 UTC-3, James Schneider escreveu: > > Are you adding REST functionality to an existing project? Or will you be > using a separate instance to provide only REST services and maintain two > different code bases? > > I believe you can use the django-rest-framework to utilize the same views > (literally) to provide a REST interface, so you may not need to rewrite or > copy anything, just add a few bits of code to make your views aware of > incoming REST requests, some URL additions, and serializers for your > models. > > http://www.django-rest-framework.org/ > > -James > On Aug 16, 2015 3:59 PM, <[email protected] <javascript:>> wrote: > >> Hey guys, >> >> I have a question about an architectural issue and I would like to hear >> some suggestions about it. >> >> I created a project using Django (let's call this Project A) and now I >> decided to start a new one but this time it is an API using Django REST. >> So, for now I have to refactor Project A to consume data from API, but in >> order to do that I need to duplicate all my models files in both projects. >> The question is how can I avoid this? Is there another way to do that? >> >> I see that *moving models *from Project A to API as something natural >> but to have an empty models file in Project A I need to change some >> concepts, for removing ModelForms and put all validation logic using Form. >> >> How do you guys see this? Would you recommend something different? Is >> that a good idea? >> >> 1. Project A (Models) <---> API (same models??? How can I handle >> that?) >> 2. Project A (No models) <---> API (Models) >> >> Thanks in advance! >> >> -- >> 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 [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/11d2f88e-a159-4e7b-903f-80d0f6e8e74a%40googlegroups.com >> >> <https://groups.google.com/d/msgid/django-users/11d2f88e-a159-4e7b-903f-80d0f6e8e74a%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/146545e5-8a5a-43ab-b4d7-3fa00d4f0dbb%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

