GithubHelp home page GithubHelp logo

kevinastone / django-api-rest-and-angular Goto Github PK

View Code? Open in Web Editor NEW
806.0 806.0 298.0 1.16 MB

An example repository of combining Django Rest Framework with AngularJS

Home Page: http://kevinastone.github.io/getting-started-with-django-rest-framework-and-angularjs.html

CoffeeScript 15.25% Makefile 0.94% Python 68.06% HTML 13.51% Dockerfile 2.24%

django-api-rest-and-angular's Introduction

Django API with Django Rest Framework and AngularJS-Resource

This sample project is the companion of a blog post on how to get started with Django Rest Framework and AngularJS.

Dependencies

To setup and run the sample code, you're going to need npm from NodeJS available to install the frontend code.

Setup

Docker

If you have a docker host, you can simply use docker-compose to build the example, then open http://localhost:

docker-compose up

Manual

You're encouraged to setup a virtualenv to work in prior to configuring the dependencies.

  1. Install Python Requirements

     pip install -r requirements.txt
     python setup.py develop
    
  2. Install Bower + Grunt

     npm install -g grunt-cli bower
    
  3. Install Assets

     npm install
     bower install
    
  4. Compile Assets

     grunt
    
  5. Setup the Database

     make create_database; make make_fixtures
    
  6. Run the Server

     ./manage.py runserver
    

django-api-rest-and-angular's People

Contributors

darkfisk avatar example123 avatar johnfraney avatar kevinastone avatar nadirs avatar shalbafzadeh avatar sodrooome avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-api-rest-and-angular's Issues

Photo upload

If i would like to implement a photo uploader in this example, or for a model that have an imagefield, what should i do?

django

how to convert database of this example
to mongodb

error in rest_framework.PostList when requesting basic ajax example

I setup everything following the README and am getting this error when requesting the basic ajax example http://localhost:8002/basic

(tutovenv) nick@dose  (master) ~/django-api-rest-and-angular\> ./manage.py runserver localhost:8002
Performing system checks...

System check identified no issues (5 silenced).
March 18, 2016 - 05:55:50
Django version 1.9.2, using settings 'example.settings'
Starting development server at http://localhost:8002/
Quit the server with CONTROL-C.
[18/Mar/2016 05:55:58] "GET /basic HTTP/1.1" 200 1104
[18/Mar/2016 05:55:58] "GET /static/js/script.js HTTP/1.1" 304 0
Internal Server Error: /api/posts
Traceback (most recent call last):
  File "/home/nick/django-api-rest-and-angular/tutovenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 149, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/nick/django-api-rest-and-angular/tutovenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 147, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/nick/django-api-rest-and-angular/tutovenv/lib/python3.5/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/nick/django-api-rest-and-angular/tutovenv/lib/python3.5/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/nick/django-api-rest-and-angular/tutovenv/lib/python3.5/site-packages/rest_framework/views.py", line 466, in dispatch
    response = self.handle_exception(exc)
  File "/home/nick/django-api-rest-and-angular/tutovenv/lib/python3.5/site-packages/rest_framework/views.py", line 463, in dispatch
    response = handler(request, *args, **kwargs)
  File "/home/nick/django-api-rest-and-angular/tutovenv/lib/python3.5/site-packages/rest_framework/generics.py", line 243, in get
    return self.list(request, *args, **kwargs)
  File "/home/nick/django-api-rest-and-angular/tutovenv/lib/python3.5/site-packages/rest_framework/mixins.py", line 40, in list
    queryset = self.filter_queryset(self.get_queryset())
  File "/home/nick/django-api-rest-and-angular/tutovenv/lib/python3.5/site-packages/rest_framework/generics.py", line 67, in get_queryset
    % self.__class__.__name__
AssertionError: 'PostList' should either include a `queryset` attribute, or override the `get_queryset()` method.

I thought maybe the Django version pulled in by requirements.txt was too new (it pulled 1.9.4), so I uninstalled that using pip and installed Django==1.9.2 instead. That didn't help, same error.

EDIT: also tried djangorestframework 3.3.0 instead of 3.3.3, same error

Not sure what to make of it (not an expert obviously).

TemplateDoesNotExist for site-packages

Cannot figure out what's wrong, I have an issue accessing the templates from site-packages.
I tried both with Django==1.7, Django==1.8 didn't find any solution.

Django is looking for the template at /site-packages/rest_framework/templates/api.html (File does not exist) when the real directory is /site-packages/rest_framework/templates/rest_framework/api.html (File does not exist)

I'm not sure what's the issue.
Thanks (great tutorial by the way :-))

TemplateDoesNotExist at /api
api.html
Request Method: GET
Request URL: http://localhost:8000/api
Django Version: 1.7
Exception Type: TemplateDoesNotExist
Exception Value:
api.html
Exception Location: /Users/joachimhagege/Dropbox/Workspace/Django/django-api-rest-and-angular/env/lib/python2.7/site-packages/django/template/loader.py in select_template, line 194
Python Executable: /Users/joachimhagege/Dropbox/Workspace/Django/django-api-rest-and-angular/env/bin/python
Python Version: 2.7.6
Python Path:
['/Users/joachimhagege/Dropbox/Workspace/Django/django-api-rest-and-angular',
'/Users/joachimhagege/Dropbox/Workspace/Django/django-api-rest-and-angular/env/lib/python27.zip',
'/Users/joachimhagege/Dropbox/Workspace/Django/django-api-rest-and-angular/env/lib/python2.7',
'/Users/joachimhagege/Dropbox/Workspace/Django/django-api-rest-and-angular/env/lib/python2.7/plat-darwin',
'/Users/joachimhagege/Dropbox/Workspace/Django/django-api-rest-and-angular/env/lib/python2.7/plat-mac',
'/Users/joachimhagege/Dropbox/Workspace/Django/django-api-rest-and-angular/env/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/joachimhagege/Dropbox/Workspace/Django/django-api-rest-and-angular/env/Extras/lib/python',
'/Users/joachimhagege/Dropbox/Workspace/Django/django-api-rest-and-angular/env/lib/python2.7/lib-tk',
'/Users/joachimhagege/Dropbox/Workspace/Django/django-api-rest-and-angular/env/lib/python2.7/lib-old',
'/Users/joachimhagege/Dropbox/Workspace/Django/django-api-rest-and-angular/env/lib/python2.7/lib-dynload',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/joachimhagege/Dropbox/Workspace/Django/django-api-rest-and-angular/env/lib/python2.7/site-packages']
Server time: Wed, 5 Aug 2015 10:50:13 -0700
Template-loader postmortem

Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
Using loader django.template.loaders.app_directories.Loader:
/Users/joachimhagege/Dropbox/Workspace/Django/django-api-rest-and-angular/env/lib/python2.7/site-packages/django/contrib/auth/templates/api.html (File does not exist)
/Users/joachimhagege/Dropbox/Workspace/Django/django-api-rest-and-angular/env/lib/python2.7/site-packages/django_extensions/templates/api.html (File does not exist)
/Users/joachimhagege/Dropbox/Workspace/Django/django-api-rest-and-angular/env/lib/python2.7/site-packages/rest_framework/templates/api.html (File does not exist)
/Users/joachimhagege/Dropbox/Workspace/Django/django-api-rest-and-angular/example/api/templates/api.html (File does not exist)
/Users/joachimhagege/Dropbox/Workspace/Django/django-api-rest-and-angular/env/lib/python2.7/site-packages/django/contrib/admin/templates/api.html (File does not exist)

Problem executing step 5: make create_database

Hi Kevin,

I was trying to setup everything to follow up the tutorial but I couldn't make it work. I did the first four steps without problems, but I got stuck in the next one. I am getting this error:

(kevinastone-tutorial)rcanepa@rcanepa-R480:~/Development/django_projects/kevinastone-tutorial/django-api-rest-and-angular$ make create_database 
./manage.py syncdb --noinput
System check identified some issues:

WARNINGS:
?: (1_6.W001) Some project unittests may not execute as expected.
        HINT: Django 1.6 introduced a new default test runner. It looks like this project was generated using Django 1.5 or earlier. You should ensure your tests are all running & behaving as expected. See https://docs.djangoproject.com/en/dev/releases/1.6/#new-test-runner for more information.
Syncing...
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/rcanepa/.virtualenvs/kevinastone-tutorial/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/home/rcanepa/.virtualenvs/kevinastone-tutorial/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/rcanepa/.virtualenvs/kevinastone-tutorial/local/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/rcanepa/.virtualenvs/kevinastone-tutorial/local/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/home/rcanepa/.virtualenvs/kevinastone-tutorial/local/lib/python2.7/site-packages/django/core/management/base.py", line 533, in handle
    return self.handle_noargs(**options)
  File "/home/rcanepa/.virtualenvs/kevinastone-tutorial/local/lib/python2.7/site-packages/south/management/commands/syncdb.py", line 82, in handle_noargs
    old_app_store, cache.app_store = cache.app_store, SortedDict([
AttributeError: 'Apps' object has no attribute 'app_store'
make: *** [create_database] Error 1

Any idea of what could be happening?.

Regards,

Renzo

incompatible django_rest_framework version?

On a fresh installation based on master (e5c2ef6)

Internal Server Error: /api/posts
Traceback (most recent call last):
  File "/Users/stefanfoulis/.virtualenvs/EXPERIMENT-django-api-rest-and-angular/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/stefanfoulis/.virtualenvs/EXPERIMENT-django-api-rest-and-angular/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/Users/stefanfoulis/.virtualenvs/EXPERIMENT-django-api-rest-and-angular/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 57, in wrapped_view
    return view_func(*args, **kwargs)
  File "/Users/stefanfoulis/.virtualenvs/EXPERIMENT-django-api-rest-and-angular/lib/python2.7/site-packages/rest_framework/views.py", line 400, in dispatch
    response = self.handle_exception(exc)
  File "/Users/stefanfoulis/.virtualenvs/EXPERIMENT-django-api-rest-and-angular/lib/python2.7/site-packages/rest_framework/views.py", line 397, in dispatch
    response = handler(request, *args, **kwargs)
  File "/Users/stefanfoulis/.virtualenvs/EXPERIMENT-django-api-rest-and-angular/lib/python2.7/site-packages/rest_framework/generics.py", line 470, in post
    return self.create(request, *args, **kwargs)
  File "/Users/stefanfoulis/.virtualenvs/EXPERIMENT-django-api-rest-and-angular/lib/python2.7/site-packages/rest_framework/mixins.py", line 52, in create
    if serializer.is_valid():
  File "/Users/stefanfoulis/.virtualenvs/EXPERIMENT-django-api-rest-and-angular/lib/python2.7/site-packages/rest_framework/serializers.py", line 553, in is_valid
    return not self.errors
  File "/Users/stefanfoulis/.virtualenvs/EXPERIMENT-django-api-rest-and-angular/lib/python2.7/site-packages/rest_framework/serializers.py", line 545, in errors
    ret = self.from_native(data, files)
  File "/Users/stefanfoulis/.virtualenvs/EXPERIMENT-django-api-rest-and-angular/lib/python2.7/site-packages/rest_framework/serializers.py", line 998, in from_native
    return self.full_clean(instance)
  File "/Users/stefanfoulis/.virtualenvs/EXPERIMENT-django-api-rest-and-angular/lib/python2.7/site-packages/rest_framework/serializers.py", line 932, in full_clean
    instance.full_clean(exclude=self.get_validation_exclusions(instance))
TypeError: get_validation_exclusions() takes exactly 1 argument (2 given)
[16/Jul/2014 12:22:24] "POST /api/posts HTTP/1.1" 500 105571

Clean install none of the examples working

Hi, I love the blog-post and was eager to play with the code. Sadly, none of it is working. Followed the install instructions to detail and everything running smoothly.

The error are for all (except static) examples:

AssertionError: 'PostList' should either include a `queryset` attribute, or over
ride the `get_queryset()` method.
[27/Mar/2016 21:48:15] "GET /api/posts HTTP/1.1" 500 91167

My noob-brain cannot help here, sorry...

Initial migration failing

I get this error when the makefile runs the initial migration:

django.core.exceptions.FieldDoesNotExist: User_groups has no field named None

Maybe this cropped up in the latest version of Django?

I was able to work around this with:

  rm example/api/migrations/0001_initial.py*
  rm example/api/migrations/0002_auto_20150525_1522.py*
  ./manage.py makemigrations

errorin setup all environment

hi i tried with your example
but when i give command likn

npm install
bower install

so ti show that
"/usr/bin/env: node: No such file or directory"
how can i solve this

and when i try to open
http://localhost:8000/resource
so it shows

{{ post.title }} {{ post.author.username }}

{{ post.body }}

django template tag as output

Need some more help

Hi,

Great Work !! This has helped me a lot.

I am completely new to Django and Web Development, can you help me a bit here.

I tried running the code and it seems to be working fine to a certain extent, but when I am opening the address 127.0.0.1:8000 the I am unable to see the posts or something. All I am seeing is the attached screen shot.

screen_selection_003

cant run

i can't run this project on my local system
i get this error:
DoesNotExist at /admin/login/

User matching query does not exist.

Request Method: POST
Request URL: http://127.0.0.1:8080/admin/login/?next=/admin/
Django Version: 1.10.4
Exception Type: DoesNotExist
Exception Value:

User matching query does not exist.

Exception Location: C:\Python35\lib\site-packages\django\db\models\query.py in get, line 385
Python Executable: C:\Python35\python.exe
Python Version: 3.5.2
Python Path:

['G:\py36_dj110\django-api-rest-and-angular-master',
'C:\Python35\python35.zip',
'C:\Python35\DLLs',
'C:\Python35\lib',
'C:\Python35',
'C:\Python35\lib\site-packages']

Server time: Tue, 28 Mar 2017 00:37:23 -0700

Update installation instruction for libjpeg8-dev

I got a jpeg ValueError during installation with pip install -r requirements.txt

I found out that needed to install libjpeg8-dev with

sudo apt-get install libjpeg8-dev

It will be useful to update the installation instruction with this info.

All static/ are not found

Hi,thank you for your codes! I succesfully run the project ,but I could not find /static/ directory, Is this dir upload to repository or where could i get them

Problem in "Setup Database" step

When following the steps to setup the project, I get the following errors when I run the make create_database; make make_fixtures command. I get the same problems whether running on Django1.7 or 1.8.

(venvDjango1.7)[oussama@oussa django-api-rest-and-angular]$ make create_database; make make_fixtures
./manage.py syncdb --noinput
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/core/management/base.py", line 533, in handle
    return self.handle_noargs(**options)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 27, in handle_noargs
    call_command("migrate", **options)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 115, in call_command
    return klass.execute(*args, **defaults)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 63, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/db/migrations/executor.py", line 17, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/db/migrations/loader.py", line 48, in __init__
    self.build_graph()
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/db/migrations/loader.py", line 173, in build_graph
    self.load_disk()
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/db/migrations/loader.py", line 103, in load_disk
    migration_module = import_module("%s.%s" % (module_name, migration_name))
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/oussama/PycharmProjects/django-api-rest-and-angular/example/api/migrations/0002_auto_20150427_0318.py", line 9, in <module>
    class Migration(migrations.Migration):
  File "/home/oussama/PycharmProjects/django-api-rest-and-angular/example/api/migrations/0002_auto_20150427_0318.py", line 16, in Migration
    migrations.AlterModelManagers(
AttributeError: 'module' object has no attribute 'AlterModelManagers'
Makefile:5: recipe for target 'create_database' failed
make: *** [create_database] Error 1
./manage.py create_users
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/home/oussama/PycharmProjects/django-api-rest-and-angular/example/api/management/commands/create_users.py", line 11, in handle
    User.objects.create(username=username, email="{}@example.com".format(username), first_name=user)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/db/models/manager.py", line 92, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/db/models/query.py", line 372, in create
    obj.save(force_insert=True, using=self.db)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/db/models/base.py", line 590, in save
    force_update=force_update, update_fields=update_fields)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/db/models/base.py", line 618, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/db/models/base.py", line 699, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/db/models/base.py", line 732, in _do_insert
    using=using, raw=raw)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/db/models/manager.py", line 92, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/db/models/query.py", line 921, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 920, in execute_sql
    cursor.execute(sql, params)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/db/backends/utils.py", line 81, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
  File "/home/oussama/Envs/venvDjango1.7/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 485, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: api_user
Makefile:10: recipe for target 'make_fixtures' failed
make: *** [make_fixtures] Error 1

It works!

Works as described. No dependency issues or NPM hell.

Congrats!

AssertionError: `HyperlinkedIdentityField` requires the request in the serializer context.

Hi,

It looks like I don't get a warning, but I get an assertion error.

image

>>> serializer = UserSerializer(user)
>>> serializer.data
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/work/playground/python/django-angular/virtualenv/local/lib/python2.7/site-packages/rest_framework/serializers.py", line 572, in data
    self._data = self.to_native(obj)
  File "/work/playground/python/django-angular/virtualenv/local/lib/python2.7/site-packages/rest_framework/serializers.py", line 351, in to_native
    value = field.field_to_native(obj, field_name)
  File "/work/playground/python/django-angular/virtualenv/local/lib/python2.7/site-packages/rest_framework/relations.py", line 529, in field_to_native
    "`HyperlinkedIdentityField` requires the request in the serializer"
AssertionError: `HyperlinkedIdentityField` requires the request in the serializer context. Add `context={'request': request}` when instantiating the serializer.

ImportError: No module named 'example'

When running: " make create_database; make make_fixtures"

I get an ImportError:

DJANGO_SETTINGS_MODULE='example.settings' ./scripts/create_users.py
Traceback (most recent call last):
File "./scripts/create_users.py", line 3, in
from example.api.models import User
ImportError: No module named 'example'

Using Python 3.3.5 but not sure how to structure the make file so it correctly sees the "example" module.

AttributeError: 'module' object has no attribute '__file__' ... when creating the database

Using Python 3.3.5 and getting this error on last step in the instructions (e.g., "make create_database; ...")

(django_angular_tut-py3)fred@fred-mbp$ make create_database
./manage.py syncdb --noinput
Traceback (most recent call last):
File "./manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/Users/fred/.virtualenvs/django_angular_tut-py3/lib/python3.3/site-packages/django/core/management/init.py", line 399, in execute_from_command_line
utility.execute()
File "/Users/fred/.virtualenvs/django_angular_tut-py3/lib/python3.3/site-packages/django/core/management/init.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/fred/.virtualenvs/django_angular_tut-py3/lib/python3.3/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(_args, *_options.dict)
File "/Users/fred/.virtualenvs/django_angular_tut-py3/lib/python3.3/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(_args, _options)
File "/Users/fred/.virtualenvs/django_angular_tut-py3/lib/python3.3/site-packages/django/core/management/base.py", line 415, in handle
return self.handle_noargs(
_options)
File "/Users/fred/.virtualenvs/django_angular_tut-py3/lib/python3.3/site-packages/south/management/commands/syncdb.py", line 68, in handle_noargs
migrations = migration.Migrations(app_label)
File "/Users/fred/.virtualenvs/django_angular_tut-py3/lib/python3.3/site-packages/south/migration/base.py", line 64, in call
self.instances[app_label] = super(MigrationsMetaclass, self).call(app_label_to_app_module(app_label), *_kwds)
File "/Users/fred/.virtualenvs/django_angular_tut-py3/lib/python3.3/site-packages/south/migration/base.py", line 90, in init
self.set_application(application, force_creation, verbose_creation)
File "/Users/fred/.virtualenvs/django_angular_tut-py3/lib/python3.3/site-packages/south/migration/base.py", line 163, in set_application
self._load_migrations_module(application.migrations)
File "/Users/fred/.virtualenvs/django_angular_tut-py3/lib/python3.3/site-packages/south/migration/base.py", line 170, in _load_migrations_module
dirname = self.migrations_dir()
File "/Users/fred/.virtualenvs/django_angular_tut-py3/lib/python3.3/site-packages/south/migration/base.py", line 132, in migrations_dir
return os.path.dirname(module.file)
AttributeError: 'module' object has no attribute 'file'
make: *** [create_database] Error 1

TemplateDoesNotExist at /admin

Coming back to Django after a long stint away from it, wanted to browse the admin site and it can't load the admin templates. Rest of the site works fine though, so far :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.