Giter Site home page Giter Site logo

jordanirabor / django-todo-react Goto Github PK

View Code? Open in Web Editor NEW
173.0 7.0 82.0 25.17 MB

This is a demo repository for a Todo application built off Django (and the Django REST Framework for API CRUD operations) and React.

Python 31.99% HTML 7.40% CSS 5.22% JavaScript 55.39%

django-todo-react's Issues

Error importing module.

ystem check identified no issues (0 silenced).
August 20, 2020 - 12:40:18
Django version 3.1, using settings 'backend.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/core/servers/basehttp.py", line 45, in get_internal_wsgi_application
return import_string(app_path)
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/utils/module_loading.py", line 17, in import_string
module = import_module(module_path)
File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 783, in exec_module
File "", line 219, in _call_with_frames_removed
File "/home/scott/Desktop/Todo/backend/backend/wsgi.py", line 16, in
application = get_wsgi_application()
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
return WSGIHandler()
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/core/handlers/wsgi.py", line 127, in init
self.load_middleware()
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/core/handlers/base.py", line 40, in load_middleware
middleware = import_string(middleware_path)
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/utils/module_loading.py", line 17, in import_string
module = import_module(module_path)
File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 961, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 961, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 970, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'corsheaders.middleware.CorsMiddlewaredjango'; 'corsheaders.middleware' is not a package

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 138, in inner_run
handler = self.get_handler(*args, **options)
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/contrib/staticfiles/management/commands/runserver.py", line 27, in get_handler
handler = super().get_handler(*args, **options)
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 65, in get_handler
return get_internal_wsgi_application()
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/core/servers/basehttp.py", line 47, in get_internal_wsgi_application
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: WSGI application 'backend.wsgi.application' could not be loaded; Error importing module.
/home/scott/Desktop/Todo/backend/backend/settings.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks...

Exception in thread django-main-thread:
Traceback (most recent call last):
File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 118, in inner_run
self.check(display_num_errors=True)
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/core/management/base.py", line 442, in check
raise SystemCheckError(msg)
django.core.management.base.SystemCheckError: SystemCheckError: System check identified some issues:

ERRORS:
?: (corsheaders.E013) Origin '/' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin '/' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin '0' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin '0' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin '0' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin '3' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin ':' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin ':' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin 'a' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin 'c' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin 'h' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin 'h' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin 'l' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin 'l' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin 'o' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin 'o' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin 'p' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin 's' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin 't' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin 't' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).
?: (corsheaders.E013) Origin 't' in CORS_ORIGIN_WHITELIST is missing scheme or netloc
HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).

System check identified 21 issues (0 silenced).
/home/scott/Desktop/Todo/backend/backend/settings.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
August 20, 2020 - 12:41:25
Django version 3.1, using settings 'backend.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/core/servers/basehttp.py", line 45, in get_internal_wsgi_application
return import_string(app_path)
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/utils/module_loading.py", line 17, in import_string
module = import_module(module_path)
File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 783, in exec_module
File "", line 219, in _call_with_frames_removed
File "/home/scott/Desktop/Todo/backend/backend/wsgi.py", line 16, in
application = get_wsgi_application()
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
return WSGIHandler()
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/core/handlers/wsgi.py", line 127, in init
self.load_middleware()
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/core/handlers/base.py", line 40, in load_middleware
middleware = import_string(middleware_path)
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/utils/module_loading.py", line 17, in import_string
module = import_module(module_path)
File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 961, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 961, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 970, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'corsheaders.middleware.CorsMiddlewaredjango'; 'corsheaders.middleware' is not a package

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 138, in inner_run
handler = self.get_handler(*args, **options)
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/contrib/staticfiles/management/commands/runserver.py", line 27, in get_handler
handler = super().get_handler(*args, **options)
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 65, in get_handler
return get_internal_wsgi_application()
File "/home/scott/.local/share/virtualenvs/backend-cKLZGUPl/lib/python3.8/site-packages/django/core/servers/basehttp.py", line 47, in get_internal_wsgi_application
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: WSGI application 'backend.wsgi.application' could not be loaded; Error importing module.

corsheaders.E013

ERRORS: ?: (corsheaders.E013) Origin '/' in CORS_ORIGIN_WHITELIST is missing scheme or netloc HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com). ?: (corsheaders.E013) Origin '0' in CORS_ORIGIN_WHITELIST is missing scheme or netloc HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com). ?: (corsheaders.E013) Origin '0' in CORS_ORIGIN_WHITELIST is missing scheme or netloc HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com). ?: (corsheaders.E013) Origin '0' in CORS_ORIGIN_WHITELIST is missing scheme or netloc HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com). ?: (corsheaders.E013) Origin '3' in CORS_ORIGIN_WHITELIST is missing scheme or netloc HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com). ?: (corsheaders.E013) Origin ':' in CORS_ORIGIN_WHITELIST is missing scheme or netloc HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com). ?: (corsheaders.E013) Origin 'a' in CORS_ORIGIN_WHITELIST is missing scheme or netloc HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com). ?: (corsheaders.E013) Origin 'c' in CORS_ORIGIN_WHITELIST is missing scheme or netloc HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com). ?: (corsheaders.E013) Origin 'h' in CORS_ORIGIN_WHITELIST is missing scheme or netloc HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com). ?: (corsheaders.E013) Origin 'l' in CORS_ORIGIN_WHITELIST is missing scheme or netloc HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com). ?: (corsheaders.E013) Origin 'l' in CORS_ORIGIN_WHITELIST is missing scheme or netloc HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com). ?: (corsheaders.E013) Origin 'o' in CORS_ORIGIN_WHITELIST is missing scheme or netloc HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com). ?: (corsheaders.E013) Origin 'o' in CORS_ORIGIN_WHITELIST is missing scheme or netloc HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com). ?: (corsheaders.E013) Origin 's' in CORS_ORIGIN_WHITELIST is missing scheme or netloc HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com). ?: (corsheaders.E013) Origin 't' in CORS_ORIGIN_WHITELIST is missing scheme or netloc HINT: Add a scheme (e.g. https://) or netloc (e.g. example.com).

No module named 'corsheaders'

I've followed the instructions and terminal is generating errors.

To troubleshoot: I brew upgrade node and this is still generating code errors.

I must say the rest of the install went like a dream.

$ python manage.py runserver
Unhandled exception in thread started by <function check_errors..wrapper at 0x10e86bd90>
Traceback (most recent call last):
File "/Users/owner/.local/share/virtualenvs/django-todo-react-EZhWWSJP/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/Users/owner/.local/share/virtualenvs/django-todo-react-EZhWWSJP/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/Users/owner/.local/share/virtualenvs/django-todo-react-EZhWWSJP/lib/python3.6/site-packages/django/utils/autoreload.py", line 248, in raise_last_exception
raise _exception[1]
File "/Users/owner/.local/share/virtualenvs/django-todo-react-EZhWWSJP/lib/python3.6/site-packages/django/core/management/init.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "/Users/owner/.local/share/virtualenvs/django-todo-react-EZhWWSJP/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/Users/owner/.local/share/virtualenvs/django-todo-react-EZhWWSJP/lib/python3.6/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/owner/.local/share/virtualenvs/django-todo-react-EZhWWSJP/lib/python3.6/site-packages/django/apps/registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "/Users/owner/.local/share/virtualenvs/django-todo-react-EZhWWSJP/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/Users/owner/.local/share/virtualenvs/django-todo-react-EZhWWSJP/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'corsheaders'

TypeError: 'module' object is not iterable

I have tried to run your Django code. After setting URL paths for API, I'm getting the below error

Exception in thread django-main-thread:
Traceback (most recent call last):
File "/home/priyan/.local/lib/python3.5/site-packages/django/urls/resolvers.py", line 581, in url_patterns
iter(patterns)
TypeError: 'module' object is not iterable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/home/priyan/.local/lib/python3.5/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/home/priyan/.local/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
self.check(display_num_errors=True)
File "/home/priyan/.local/lib/python3.5/site-packages/django/core/management/base.py", line 390, in check
include_deployment_checks=include_deployment_checks,
File "/home/priyan/.local/lib/python3.5/site-packages/django/core/management/base.py", line 377, in _run_checks
return checks.run_checks(**kwargs)
File "/home/priyan/.local/lib/python3.5/site-packages/django/core/checks/registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/priyan/.local/lib/python3.5/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/home/priyan/.local/lib/python3.5/site-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/home/priyan/.local/lib/python3.5/site-packages/django/urls/resolvers.py", line 398, in check
for pattern in self.url_patterns:
File "/home/priyan/.local/lib/python3.5/site-packages/django/utils/functional.py", line 80, in get
res = instance.dict[self.name] = self.func(instance)
File "/home/priyan/.local/lib/python3.5/site-packages/django/urls/resolvers.py", line 588, in url_patterns
raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
django.core.exceptions.ImproperlyConfigured: The included URLconf 'backend.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.

Code: urls.py

from django.contrib import admin
from django.urls import path, include
from rest_framework import routers
from todo import views

router = routers.DefaultRouter()
router.register(r'todos', views.TodoView, 'todo')
urlpatterns = router.urls

urlpatterns = [
path('admin/', admin.site.urls), path('api/', include(router.urls))
]

CORS_ORIGIN_WHITELIST

CORS_ORIGIN_WHITELIST = (
     'localhost:3000/'
 )

didn't work in my case, so I changed it to

CORS_ORIGIN_WHITELIST = [
'http://localhost:3000',
]

you can see no slash is needed

README.md

Should it be this??
Run this command to start the frontend development server in the [frontend] directory: [npm start] (This will start the frontend on the adddress localhost:3000)

[Bug]

Hi, thank you for providing such a wonderful example of connecting frontend and backend.
I ran your project on ubuntu 18.04
frontend is good, but I met a bug in backend :(

0426_ex_django-todo-react

Sincerely

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.