Part 3: Advanced Web Development With Django

You can access this book in different file formats that are optimized to give you a great reading experience, no matter which device you are using. The options are as follows:

DRM-free PDF optimized for reading on tablets and computers:

ePub version for e-reader devices and phones/tablets:

Mobipocket (.mobi) version for reading on Kindle devices:

Nahua Kang on Jan. 15, 2020

Hi Dan, thanks a lot for the updates and the product migration!

Abbas Sheikh on March 22, 2020

Hi Dan,

I RP old customer(RP 3 book course purchase), what options do I have to unlock the newly introduced monthly subscription option?

Dan Bader RP Team on March 22, 2020

Hi Abbas, you can learn more about the membership subscription at realpython.com/join

Aqhail Mihailov on May 8, 2020

pdf Real Python part 3, page 43 change to -

class MainPageTests(TestCase):
    @classmethod
    def setUpClass(cls):
        super(MainPageTests,cls).setUpClass()

other way it will throw an error AttributeError: type object has no attribute ‘cls_atomics’. also in page 46

class UserModelTest(TestCase):
    @classmethod
    def setUpClass(cls):
        super(UserModelTest,cls).setUpClass()

Aqhail Mihailov on May 8, 2020

^ sorry, last snippet from page 51

Aqhail Mihailov on May 9, 2020

cannot run tests page 73

(django_e-commerce) @dhcppc0:~/django_e-commerce/django_ecommerce$ **./manage.py test main**
Creating test database for alias 'default'...
.EE.
======================================================================
ERROR: test_returns_appropriate_html_response_code (main.tests.MainPageTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/django_e-commerce/django_ecommerce/main/tests.py", line 21, in test_returns_appropriate_html_response_code
    resp = index(self.request)
  File "/home/django_e-commerce/django_ecommerce/main/views.py", line 8, in index
    return render_to_response(request, 'index.html')
  File "/home/django_e-commerce/lib/python3.5/site-packages/django/shortcuts.py", line 21, in render_to_response
    content = loader.render_to_string(template_name, context, using=using)
  File "/home/django_e-commerce/lib/python3.5/site-packages/django/template/loader.py", line 67, in render_to_string
    template = get_template(template_name, using=using)
  File "/home/django_e-commerce/lib/python3.5/site-packages/django/template/loader.py", line 25, in get_template
    raise TemplateDoesNotExist(template_name, chain=chain)
django.template.exceptions.TemplateDoesNotExist: <WSGIRequest: GET '/'>

======================================================================
ERROR: test_returns_exact_html (main.tests.MainPageTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/django_e-commerce/django_ecommerce/main/tests.py", line 24, in test_returns_exact_html
    resp = index(self.request)
  File "/home/django_e-commerce/django_ecommerce/main/views.py", line 8, in index
    return render_to_response(request, 'index.html')
  File "/home/django_e-commerce/lib/python3.5/site-packages/django/shortcuts.py", line 21, in render_to_response
    content = loader.render_to_string(template_name, context, using=using)
  File "/home/django_e-commerce/lib/python3.5/site-packages/django/template/loader.py", line 67, in render_to_string
    template = get_template(template_name, using=using)
  File "/home/django_e-commerce/lib/python3.5/site-packages/django/template/loader.py", line 25, in get_template
    raise TemplateDoesNotExist(template_name, chain=chain)
django.template.exceptions.TemplateDoesNotExist: <WSGIRequest: GET '/'>

----------------------------------------------------------------------
Ran 4 tests in 0.316s

FAILED (errors=2)
Destroying test database for alias 'default'...

is it so important?

Aqhail Mihailov on May 9, 2020

guys, i even can not fireup django-ecommerce site cloned from github (importError: No module named ‘embed_video’)

dhcppc0:~/book3-exercises/django_ecommerce$ ./manage.py runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7feccbd8c730>
Traceback (most recent call last):
  File "/home/django_e-commerce/lib/python3.5/site-packages/django/utils/autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "/home/django_e-commerce/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 113, in inner_run
    autoreload.raise_last_exception()
  File "/home/django_e-commerce/lib/python3.5/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception
    six.reraise(*_exception)
  File "/home/django_e-commerce/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/home/django_e-commerce/lib/python3.5/site-packages/django/utils/autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "/home/django_e-commerce/lib/python3.5/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/django_e-commerce/lib/python3.5/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/home/django_e-commerce/lib/python3.5/site-packages/django/apps/config.py", line 90, in create
    module = import_module(entry)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'embed_video'

when i try u realize where is ‘embed_video’ uses

^C(django_e-commerce) @dhcppc0:~/book3-exercises/django_ecommerce$ gp -rnw . -e 'embed_video'
Binary file ./django_ecommerce/__pycache__/settings.cpython-35.pyc matches
./django_ecommerce/settings.py:130:    'embed_video',

Whats wrong?

Ricky White RP Team on May 10, 2020

Hi Aqhail Mihailov, Can you share the code for the two tests you have that are failing? The TemplateDoesNotExist error could mean that you haven’t set your template file path in you settings.py file correctly, too.

Hiren Kamat on June 5, 2020

I see the Django version used is 1.5/1.8 which looks old. Is there any plans to update the same? Thanks

Dan Bader RP Team on June 5, 2020

Yep, we’re planning to update Part 2 and Part 3 once the refresh for Part 1 (Python Basics) has been completed.

Hiren Kamat on June 7, 2020

Cool. Thanks a lot Dan. Any approx date in mind? It would be helpful to know.

olie on Oct. 16, 2022

Are there still plans to update this looks like it was written in 2016

You must own this product to join the conversation.