Hi All,

I have a problem with the source code provided on the associated git hub 
pages: https://github.com/PacktPublishing/Django-2-by-Example After 
downloading the source files, and setting up the chapter 1 example locally, 
using the default sqlite database  everything works as expected. However, 
changing the database to mysql the site breaks. This is the scenario:
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'pedbad',
        'USER': 'root',
        'PASSWORD': 'root',
        'HOST': 'localhost',
        'PORT': '3306',
    }
}


Changing the settings.py file to use mysql works fine, and the database is 
created, and the tables are all populated correctly. using createsuperuser 
also works and I am able to access the admin backend and create a post 
navigating to :
 http://127.0.0.1:8000/blog/ shows the post and the post title link is set 
to:
http://127.0.0.1:8000/blog/2019/1/31/test-post/ however, although this 
works fine with sqllite, on mysql the link take me to a 404 page: Page not 
found (404) Request Method: GET Request URL: 
http://127.0.0.1:8000/blog/2019/1/31/test-post/ Raised by: 
blog.views.post_detail No Post matches the given query. even though the 
blog post exists in the mysql table: table blog_post id - 1 title - Test 
Post slug - test-post body - content for test post publish - 2019-01-31 
10:56:40.000000 created - 2019-01-31 10:56:59.674959 updated - 2019-01-31 
10:56:59.674976 status - published author_id -  1 I would appreciate any 
advice on why this is happening when the database is switched to MySQl 
thank you Pedram

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/270c4971-2385-41b9-b12e-cf2c6fed010b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to