I can't see my models in MySQL db

76 views
Skip to first unread message

ali reza

unread,
Jul 4, 2018, 9:20:49 AM7/4/18
to Django users
Greetings!

Note:
mysite is the name of project.
django_sb_admin and polls are my apps.
python version: 3.6.6

I used inspectdb for creating models.py for django_sb_admin application.
pyhton3 manage.py inspectdb > models.py
# Here inspectdb worked fine.
then is moved models.py into django_sb_admin app.



root@kali:~/PycharmProjects/django/azim_projs# ls
db.sqlite3  django_sb_admin  manage.py   mysite  polls

=====================================================================================
root@kali:~/PycharmProjects/django/azim_projs# cat django_sb_admin/apps.py
from django.apps import AppConfig

class DjangoSbAdminConfig(AppConfig):
    name = 'django_sb_admin'

=====================================================================================
root@kali:~/PycharmProjects/django/azim_projs# cat mysite/settings.py
<.......skipped.....>
<.......skipped.....>
<.......skipped.....>

INSTALLED_APPS = [
    'django_sb_admin.apps.DjangoSbAdminConfig',
    'polls',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

<.......skipped.....>
<.......skipped.....>
<.......skipped.....>

DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql',
            'OPTIONS': {
                'read_default_file': '/root/PycharmProjects/django/azim_projs/mysite/mySQL.conf',
            },
      }
}

=====================================================================================
root@kali:~/PycharmProjects/django/azim_projs# cat mysite/mySQL.conf
[client]
database = djangoDB
host = 127.0.0.1
user = root
password = "456789"

=====================================================================================
=====================================================================================
=====================================================================================
=====================================================================================
root@kali:~/PycharmProjects/django/azim_projs# python3 manage.py makemigrations django_sb_admin
No changes detected in app 'django_sb_admin'

=====================================================================================
root@kali:~/PycharmProjects/django/azim_projs# python3 manage.py migrate django_sb_admin
Operations to perform:
  Apply all migrations: django_sb_admin
Running migrations:
  Applying django_sb_admin.0001_initial... OK

=====================================================================================
root@kali:~/PycharmProjects/django/azim_projs# python3 manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, django_sb_admin, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying sessions.0001_initial... OK

=====================================================================================
root@kali:~/PycharmProjects/django/azim_projs# python3 manage.py sqlmigrate django_sb_admin 0001
BEGIN;
--
-- Create model Appp
--
--
-- Create model ApTT
--
--
-- Create model CCnn
--
--
-- Create model CCtt
--
--
-- Create model Lact
--
-- Create model Lapt
--
--
-- Create model Laccte
--
--
-- Create model Urmng
--
COMMIT;

=====================================================================================
Note: see attached picture, I haven't my models as tables in djangoDB database.

What's the problem !?
Why I haven't tables in DB !??!


django_failed_insert.png

Jason

unread,
Jul 4, 2018, 9:56:26 AM7/4/18
to Django users
You told it to make migration for the app django_sb_admin, but that apparently doesn't include polls.

try making another migration without the app name qualifier and running it.  

A. Azimzadeh

unread,
Jul 4, 2018, 2:27:39 PM7/4/18
to django...@googlegroups.com
Polls app is empty.

The problem is in django_sb_admin

How i can find the root cause of problem and fix that?

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a8f1fb38-8be7-40ee-b1a4-05db133ecfa2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

A. Azimzadeh

unread,
Jul 5, 2018, 3:15:33 PM7/5/18
to django...@googlegroups.com
Hi again,

Any help !??
Please help me to find and fix the root cause of problem.

Thanks

Julio Biason

unread,
Jul 5, 2018, 3:23:59 PM7/5/18
to django...@googlegroups.com
Hi Azimzadeh,

Just wondering, is django_db_admin this one https://github.com/bluszcz/django-sb-admin ? 'Cause that app doesn't have any models (it's empty https://github.com/bluszcz/django-sb-admin/blob/master/django_sb_admin/models.py), so it shouldn't create any tables.

Also, are you sure the INSTALLED_APPS shouldn't be simply 'django_sb_admin' instead of 'django_sb_admin.apps.DjangoSbAdminConfig'? Remember, you should point to APPS, not to CLASSES...

To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

For more options, visit https://groups.google.com/d/optout.



--
Julio Biason, Sofware Engineer
AZION  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101  |  Mobile: +55 51 99907 0554

A. Azimzadeh

unread,
Jul 5, 2018, 10:56:06 PM7/5/18
to django...@googlegroups.com
Hi Julio,
Thanks for reply to my question.

I created models for django-sb-admin (As default, models.py of djangosbadmin is empty + there isn't the name of app in INSTALLED APPS +....).


are you sure the INSTALLED_APPS shouldn't be simply 'django_sb_admin' instead of 'django_sb_admin.apps.DjangoSbAdminConfig'?.

Yes, because I'm following tutorials-section of django 2.0 (models tutorial/section(activating models)):


How to find the root cause of problem :(??!! 

Tnx in advance

To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

--
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 https://groups.google.com/group/django-users.



--
Julio Biason, Sofware Engineer
AZION  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101  |  Mobile: +55 51 99907 0554

--
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 https://groups.google.com/group/django-users.

Phako Perez

unread,
Jul 6, 2018, 12:50:44 PM7/6/18
to django...@googlegroups.com
Hi Azimzadeh,

I’m also new in Django but I notice you referred to app as django-sb-admin and you added in settings as django_sb_admin

Just want to point the mismatch in name, your app is with ‘-‘ whereas installed apps has ‘_’, issue could be this mismatch? As python itself is key sensitive 

Regards

Sent from my iPhone
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

ali reza

unread,
Jul 14, 2018, 6:53:15 AM7/14/18
to Django users
Hi all,

I attached my Django project as a ZIP file.
please help me to find and fix the root cause of issue.
Link:
https://ufile.io/ycmut

Thanks in advance

A. Azimzadeh

unread,
Jul 15, 2018, 12:39:46 PM7/15/18
to django...@googlegroups.com
Any help !?


--
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 https://groups.google.com/group/django-users.

A. Azimzadeh

unread,
Jul 16, 2018, 11:02:30 PM7/16/18
to django...@googlegroups.com
Greetings!

Dears, please help me.

Thanks a lot

rajib ghosh

unread,
Jul 17, 2018, 7:46:50 AM7/17/18
to django...@googlegroups.com
First check if Django is installed


Try
 Python manage.py makemigrations
ython manage.py migrate


Reply all
Reply to author
Forward
0 new messages