REST Beginner's Tutorial

50 views
Skip to first unread message

SUBHABRATA BANERJEE

unread,
May 12, 2015, 7:49:04 AM5/12/15
to django...@googlegroups.com
Dear Group,

I have just started with Django and like to practice bit of REST. If anyone may kindly suggest a beginners Tutorial for the same.
I am using Python 2.7.9 on MS-Windows 7 Professional.

Regards,
Subhabrata Banerjee.

Guilherme Leal

unread,
May 12, 2015, 7:59:42 AM5/12/15
to django...@googlegroups.com
The shortest way to go is to pick a complete framework for RESTfull apps, like Django Rest Framework. Its complete out of the box, and yet simple as it works as the Django Class Based Views. 

There are others frameworks ofcourse, or you can do it yourself with the Django CBVs, BUT i highly recomend DRF.

--
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 post to this group, send email to django...@googlegroups.com.
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/3a83299b-3dec-4096-8491-2def68ff2e7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

SUBHABRATA BANERJEE

unread,
May 12, 2015, 8:45:45 AM5/12/15
to django...@googlegroups.com
Dear Sir,

Thank you for your kind suggestion. But as I was using it I found an error as,
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Admin>cd\

C:\>cd Python27

C:\Python27>cd Lib

C:\Python27\Lib>cd site-packages

C:\Python27\Lib\site-packages>cd django

C:\Python27\Lib\site-packages\django>dir
 Volume in drive C has no label.
 Volume Serial Number is 5EDF-8D6A

 Directory of C:\Python27\Lib\site-packages\django

05/12/2015  05:31 PM    <DIR>          .
05/12/2015  05:31 PM    <DIR>          ..
05/11/2015  08:51 PM    <DIR>          apps
05/11/2015  08:55 PM    <DIR>          bin
03/20/2015  11:03 AM    <DIR>          conf
05/11/2015  08:52 PM    <DIR>          contrib
05/11/2015  08:52 PM    <DIR>          core
05/11/2015  08:52 PM    <DIR>          db
05/11/2015  08:52 PM    <DIR>          dispatch
05/11/2015  08:52 PM    <DIR>          forms
03/20/2015  11:03 AM    <DIR>          http
05/11/2015  08:52 PM    <DIR>          middleware
05/12/2015  02:17 PM    <DIR>          mysite
05/12/2015  05:36 PM    <DIR>          rest_example
03/20/2015  11:03 AM    <DIR>          shortcuts
05/11/2015  08:51 PM             7,977 shortcuts.py
05/11/2015  08:51 PM             7,328 shortcuts.pyc
05/11/2015  08:52 PM    <DIR>          template
03/20/2015  11:03 AM    <DIR>          templatetags
05/11/2015  08:52 PM    <DIR>          test
05/12/2015  04:07 PM    <DIR>          tutorial
05/11/2015  08:52 PM    <DIR>          utils
03/20/2015  11:03 AM    <DIR>          views
05/11/2015  08:51 PM               519 __init__.py
05/11/2015  08:51 PM               968 __init__.pyc
10/21/2013  07:53 AM               463 __init__.pyo
               5 File(s)         17,255 bytes
              21 Dir(s)  112,989,847,552 bytes free

C:\Python27\Lib\site-packages\django>cd rest_example

C:\Python27\Lib\site-packages\django\rest_example>dir
 Volume in drive C has no label.
 Volume Serial Number is 5EDF-8D6A

 Directory of C:\Python27\Lib\site-packages\django\rest_example

05/12/2015  05:36 PM    <DIR>          .
05/12/2015  05:36 PM    <DIR>          ..
05/12/2015  05:36 PM            36,864 db.sqlite3
05/12/2015  05:31 PM               255 manage.py
05/12/2015  05:42 PM    <DIR>          restapp
05/12/2015  05:46 PM    <DIR>          rest_example
               2 File(s)         37,119 bytes
               4 Dir(s)  112,989,847,552 bytes free

C:\Python27\Lib\site-packages\django\rest_example>python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).

You have unapplied migrations; your app may not work properly until they are app
lied.
Run 'python manage.py migrate' to apply them.
May 12, 2015 - 17:58:41
Django version 1.8.1, using settings 'rest_example.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[12/May/2015 18:03:01]"GET /admin/ HTTP/1.1" 500 71214
^C
C:\Python27\Lib\site-packages\django\rest_example>cd..

C:\Python27\Lib\site-packages\django>dir
 Volume in drive C has no label.
 Volume Serial Number is 5EDF-8D6A

 Directory of C:\Python27\Lib\site-packages\django

05/12/2015  05:31 PM    <DIR>          .
05/12/2015  05:31 PM    <DIR>          ..
05/11/2015  08:51 PM    <DIR>          apps
05/11/2015  08:55 PM    <DIR>          bin
03/20/2015  11:03 AM    <DIR>          conf
05/11/2015  08:52 PM    <DIR>          contrib
05/11/2015  08:52 PM    <DIR>          core
05/11/2015  08:52 PM    <DIR>          db
05/11/2015  08:52 PM    <DIR>          dispatch
05/11/2015  08:52 PM    <DIR>          forms
03/20/2015  11:03 AM    <DIR>          http
05/11/2015  08:52 PM    <DIR>          middleware
05/12/2015  02:17 PM    <DIR>          mysite
05/12/2015  05:36 PM    <DIR>          rest_example
03/20/2015  11:03 AM    <DIR>          shortcuts
05/11/2015  08:51 PM             7,977 shortcuts.py
05/11/2015  08:51 PM             7,328 shortcuts.pyc
05/11/2015  08:52 PM    <DIR>          template
03/20/2015  11:03 AM    <DIR>          templatetags
05/11/2015  08:52 PM    <DIR>          test
05/12/2015  04:07 PM    <DIR>          tutorial
05/11/2015  08:52 PM    <DIR>          utils
03/20/2015  11:03 AM    <DIR>          views
05/11/2015  08:51 PM               519 __init__.py
05/11/2015  08:51 PM               968 __init__.pyc
10/21/2013  07:53 AM               463 __init__.pyo
               5 File(s)         17,255 bytes
              21 Dir(s)  112,988,057,600 bytes free

C:\Python27\Lib\site-packages\django>cd tutorial

C:\Python27\Lib\site-packages\django\tutorial>python ./manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).

You have unapplied migrations; your app may not work properly until they are app
lied.
Run 'python manage.py migrate' to apply them.
May 12, 2015 - 18:07:40
Django version 1.8.1, using settings 'tutorial.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[12/May/2015 18:08:13]"GET /users/ HTTP/1.1" 500 82396

How to fix it? If anyone may kindly suggest?

Regards,
Subhabrata Banerjee.

Guilherme Leal

unread,
May 12, 2015, 9:00:51 AM5/12/15
to django...@googlegroups.com
Sorry, but despite the fact that you have unapplied migrations, there is no error on your app.

(To apply the migrations, simply run python manage.py migrate)

Guilherme Leal

unread,
May 12, 2015, 9:02:58 AM5/12/15
to django...@googlegroups.com
The get status 500 "per se" may or may not be an error. Please, send the traceback of the error, otherwise, we can't help you much.

SUBHABRATA BANERJEE

unread,
May 12, 2015, 9:55:58 AM5/12/15
to django...@googlegroups.com
Thank you Sir, for your kind reply. I ran python manage.py migrate and then issue was fixed at command prompt,
but as I tried the http://127.0.0.1/ ... I initially got few indentation errors etc. but the issue seems now fixed as I tried
to fix those minor errors.

Regards,
Subhabrata Banerjee.
Reply all
Reply to author
Forward
0 new messages