[Django]-Problem importing module for GRAPHENE setting 'SCHEMA' in Django 2.2

2πŸ‘

You should use the right path of your project in settings.py

GRAPHENE = {
    'SCHEMA': 'django_root.schema.schema'  #  change your path
}

Where path.schema.schema is the location of the Schema object in your Django project.

πŸ‘€everfight

2πŸ‘

'SCHEMA': 'addyourappnamehere.schema.schema',

faced the same error
this worked
i added the app name
eg:

'SCHEMA': 'auth.schema.schema',
πŸ‘€fuse

0πŸ‘

The problem is you have to address the path where your schema.py is located. For example, the app name in which you have looks like the following project outline:

django_project
β”œβ”€β”€ app_name
β”‚   β”œβ”€β”€ model.py
β”‚   β”œβ”€β”€ schema.py
β”‚   └── ...
β”œβ”€β”€ django_project
β”‚   β”œβ”€β”€ settings.py
β”‚   └── ...
└── ...

Now into the settings.py add the following lines:

INSTALLED_APPS = (
    # ...
    'app_name',
    'django.contrib.staticfiles', # Required for GraphiQL
    'graphene_django',
)

GRAPHENE = {
    'SCHEMA': 'app_name.schema.schema' # Where your Graphene schema lives
}

[NOTE]:

You can also follow this instruction step by step.

Leave a comment