ModuleNotFoundError: No module named 'crispy_formsmain' - python

Please help me as I am new to Django and I am learning out of my curiosity. I tried to find the solution but couldn't. I have spent 2 days to find the appropriate solution. Please help.
I cloned the repository from github and it gives me the error as follows:
(env) C:\Users\Tenzin Karma\Desktop\critique\Wrappers-India-Online-master>python manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\threading.py", line 954, in _bootstrap_inner
self.run()
File `"C:\ProgramFiles\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\threading.py", line 892, in run`
self._target(*self._args, **self._kwargs)
File "C:\Users\Tenzin Karma\Desktop\critique\Wrappers-India-Online-master\env\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\Tenzin Karma\Desktop\critique\Wrappers-India-Online-master\env\lib\site-`packages\django\core\management\commands\runserver.py", line 110, in inner_runautoreload.raise_last_exception()`
File "C:\Users\Tenzin Karma\Desktop\critique\Wrappers-India-Online-master\env\lib\site-packages\django\utils\autoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "C:\Users\Tenzin Karma\Desktop\critique\Wrappers-India-Online-master\env\lib\site-packages\django\core\management\__init__.py", line 375, in execute
autoreload.check_errors(django.setup)()
File "C:\Users\Tenzin Karma\Desktop\critique\Wrappers-India-Online-master\env\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\Tenzin Karma\Desktop\critique\Wrappers-India-Online-master\env\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Tenzin Karma\Desktop\critique\Wrappers-India-Online-master\env\lib\site-packages\django\apps\registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "C:\Users\Tenzin Karma\Desktop\critique\Wrappers-India-Online-master\env\lib\site-packages\django\apps\config.py", line 224, in create
import_module(entry)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1520.0_x64__qbz5n2kfra8p0\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'crispy_formsmain'

Looking at the error , it looks like you are missing the module. You can try
pip install django-crispy-forms
Also from the error logs , I can see you are using virtual env, please make sure you install the package in the same venv.
Once installed, if it still shows the error , then
in settings.py installed apps add crispy_forms In settings.py add CRISPY_TEMPLATE_PACK = 'bootstrap4

Related

Error running Django: ModuleNotFoundError: No module named 'pyshop.settings'

I have started learning Django and I am unable to run the server.
Python and PyCharm are freshly installed I have installed Django by command pip install Django. After that when I run the command python manage.py runserver it gives me error:
no such file and directory
so I copied the manage.py file and paste right under the path which was written and when I typed again it shows me this weird long error I have tried every path but it gives me an error of no such file and directory only on one path which gives me a weird long error which is
(venv) C:\Users\Usman Raees\PycharmProjects\pyshop>python manage.py runserver
Traceback (most recent call last):
File "C:\Users\Usman Raees\PycharmProjects\pyshop\venv\lib\site-packages\django\core\management\base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Usman Raees\PycharmProjects\pyshop\venv\lib\site-packages\django\core\management\commands\runserver.py", line 61, in execute
super().execute(*args, **options)
File "C:\Users\Usman Raees\PycharmProjects\pyshop\venv\lib\site-packages\django\core\management\base.py", line 371, in execute
output = self.handle(*args, **options)
File "C:\Users\Usman Raees\PycharmProjects\pyshop\venv\lib\site-packages\django\core\management\commands\runserver.py", line 68, in handle
if not settings.DEBUG and not settings.ALLOWED_HOSTS:
File "C:\Users\Usman Raees\PycharmProjects\pyshop\venv\lib\site-packages\django\conf\__init__.py", line 83, in __getattr__
self._setup(name)
File "C:\Users\Usman Raees\PycharmProjects\pyshop\venv\lib\site-packages\django\conf\__init__.py", line 70, in _setup
self._wrapped = Settings(settings_module)
File "C:\Users\Usman Raees\PycharmProjects\pyshop\venv\lib\site-packages\django\conf\__init__.py", line 177, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\Usman Raees\AppData\Local\Programs\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'pyshop.settings'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Usman Raees\PycharmProjects\pyshop\venv\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\Usman Raees\PycharmProjects\pyshop\venv\lib\site-packages\django\core\management\__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Usman Raees\PycharmProjects\pyshop\venv\lib\site-packages\django\core\management\base.py", line 343, in run_from_argv
connections.close_all()
File "C:\Users\Usman Raees\PycharmProjects\pyshop\venv\lib\site-packages\django\db\utils.py", line 232, in close_all
for alias in self:
File "C:\Users\Usman Raees\PycharmProjects\pyshop\venv\lib\site-packages\django\db\utils.py", line 226, in __iter__
return iter(self.databases)
File "C:\Users\Usman Raees\PycharmProjects\pyshop\venv\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\Usman Raees\PycharmProjects\pyshop\venv\lib\site-packages\django\db\utils.py", line 153, in databases
self._databases = settings.DATABASES
File "C:\Users\Usman Raees\PycharmProjects\pyshop\venv\lib\site-packages\django\conf\__init__.py", line 83, in __getattr__
self._setup(name)
File "C:\Users\Usman Raees\PycharmProjects\pyshop\venv\lib\site-packages\django\conf\__init__.py", line 70, in _setup
self._wrapped = Settings(settings_module)
File "C:\Users\Usman Raees\PycharmProjects\pyshop\venv\lib\site-packages\django\conf\__init__.py", line 177, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\Usman Raees\AppData\Local\Programs\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'pyshop.settings'
(venv) C:\Users\Usman Raees\PycharmProjects\pyshop>
python manage.py relies of configurations in the settings.py file. Check that you still have settings.py, you might have deleted it my mistake. Thats worked for me
Since you just started learning . create a new Django project in python (pycharm professional) and start the app again and do not copy manage.py file anywhere.
also run the
$ django-admin.py startproject Yourprojectname
before you run the
python manage.py runserver

Django Error Module 'Whitenoise' not found

I'm using whitenoise to deploy static files in prod, so according to whitenoise's docs, it's recommended to use it in development too.
So I followed the documentation and added the following to my settings.py file:
INSTALLED_APPS = [
'whitenoise.runserver_nostatic',
'django.contrib.admin',
...other
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
...other
]
But when I run the server using python manage.py runserver 0.0.0.0:8000, I get the error
ModuleNotFoundError: No module named 'whitenoise'
Full stack trace:
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/path/to/venv/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/path/to/venv/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/path/to/venv/lib/python3.7/site-packages/django/utils/autoreload.py", line 76, in raise_last_exception
raise _exception[1]
File "/path/to/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 357, in execute
autoreload.check_errors(django.setup)()
File "/path/to/venv/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/path/to/venv/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/path/to/venv/lib/python3.7/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/path/to/venv/lib/python3.7/site-packages/django/apps/config.py", line 116, in create
mod = import_module(mod_path)
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'whitenoise'
I checked using pip freeze and the module IS installed (v5.0.1) along with django 3.0.4. So why am I getting that error?
this issue will be resolved by installing whitenose module to your virtual environment or globally.
pip install whitenoise

Error: 'dagster.core.types.runtime' is not a package

Installed dagster for the first time in a conda environment and tried to run the airline demo as described here. The following are the steps I followed.
conda env create -n dagster python=3.7
conda activate dagster
pip install dagster dagit
git clone git#github.com/dagster-io/dagster.git
cd dagster/examples
pip install -e '[.full]'
docker-compose up -d
cd dagster_examples/airline_demo
dagit
I then get the following stack trace ending in the 'dagster.core.types.runtime' is not a package message:
Loading repository...
Traceback (most recent call last):
File "/Users/timrozmajzl/miniconda3/envs/dagster/bin/dagit-cli", line 8, in <module>
sys.exit(main())
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagit/cli.py", line 110, in main
cli = create_dagit_cli()
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagit/cli.py", line 21, in create_dagit_cli
return ui(auto_envvar_prefix='DAGIT') # pylint: disable=no-value-for-parameter
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagit/cli.py", line 72, in ui
host_dagit_ui(handle, host, port, storage_fallback, reload_trigger)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagit/cli.py", line 81, in host_dagit_ui
app = create_app(handle, instance, reloader)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagit/app.py", line 160, in create_app
version=__version__,
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagster_graphql/implementation/context.py", line 17, in __init__
self.repository_definition = self.get_handle().build_repository_definition()
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagster/core/definitions/handle.py", line 392, in build_repository_definition
obj = self.entrypoint.perform_load()
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagster/core/definitions/handle.py", line 445, in entrypoint
return self.data.get_repository_entrypoint(from_handle=self)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagster/core/definitions/handle.py", line 522, in get_repository_entrypoint
return LoaderEntrypoint.from_yaml(self.repository_yaml, from_handle=from_handle)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagster/core/definitions/handle.py", line 175, in from_yaml
return LoaderEntrypoint.from_module_target(module_name, fn_name, from_handle)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/site-packages/dagster/core/definitions/handle.py", line 161, in from_module_target
module = importlib.import_module(module_name)
File "/Users/timrozmajzl/miniconda3/envs/dagster/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/timrozmajzl/Projects/dagster/dagster/examples/dagster_examples/airline_demo/repository.py", line 3, in <module>
from .pipelines import define_airline_demo_ingest_pipeline, define_airline_demo_warehouse_pipeline
File "/Users/timrozmajzl/Projects/dagster/dagster/examples/dagster_examples/airline_demo/pipelines.py", line 14, in <module>
from .resources import postgres_db_info_resource, redshift_db_info_resource
File "/Users/timrozmajzl/Projects/dagster/dagster/examples/dagster_examples/airline_demo/resources.py", line 3, in <module>
from .types import DbInfo
File "/Users/timrozmajzl/Projects/dagster/dagster/examples/dagster_examples/airline_demo/types.py", line 8, in <module>
from dagster.core.types.runtime.runtime_type import create_string_type
ModuleNotFoundError: No module named 'dagster.core.types.runtime.runtime_type'; 'dagster.core.types.runtime' is not a package
Thanks for reporting this issue! After some digging, it seems like this commit was not compatible with the latest release of dagster (at the time) which caused the error.
Re-running this workflow with the most recent dagster master and dependencies should resolve this. Opening an issue here to track a more long-term fix.
More details: In this commit, 'create_string_type' is introduced to both 'examples/dagster_examples/airline_demo/types.py' and 'python_modules/dagster/dagster/core/types/runtime/runtime_type.py'. However, based on the commands pasted in the question and present in the airline demo steps, airline_demo pipeline was running the tip of master (which contained 'create_string_type') with an older dagster package (from the latest release, which did not contain 'create_string_type').

Django runserver error, new installation, first time user of Django

So I've decided to learn Django, which will be challenging if I cannot get it working.
Running
Python 3.7.1 (default, Dec 14 2018, 19:28:38)
[GCC 7.3.0] :: Anaconda, Inc. on linux
(base) runout#runout:~$ python -m django --version
2.2.1
I'm following the tutorial for beginners at djangoproject.com
The first line of code was to create a site, which i did...
django-admin startproject mysite
The second line of code, is where I run into problems.
python manage.py runserver
My error is as follows:
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/home/runout/anaconda3/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/home/runout/anaconda3/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/utils/autoreload.py", line 77, in raise_last_exception
raise _exception[0](_exception[1]).with_traceback(_exception[2])
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/apps/config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "/home/runout/anaconda3/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/db/models/base.py", line 117, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/db/models/base.py", line 321, in add_to_class
value.contribute_to_class(cls, name)
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/db/models/options.py", line 204, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/db/__init__.py", line 28, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/db/utils.py", line 201, in __getitem__
backend = load_backend(db['ENGINE'])
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/db/utils.py", line 110, in load_backend
return import_module('%s.base' % backend_name)
File "/home/runout/anaconda3/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 28, in <module>
from .introspection import DatabaseIntrospection # isort:skip
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/db/backends/sqlite3/introspection.py", line 4, in <module>
import sqlparse
ModuleNotFoundError: No module named 'sqlparse'
I know nothing of Django, I'm excited to learn. I've looked all over the net and SO for a solution to this problem to no avail. Can anyone get me up and running?
Apparently a python package is missing. You can install it like this:
pip install sqlparse
You're on Linux so install 'sqlparse' by typing:
pip3 install sqlparse. Also you should call python with python3, so that it's not confused with python2.

JetBrains Pycharm - Getting error while debugging my project

I just switched to Mac from windows.
I imported my project in pycharm from GitHub but it is giving unknown errors.
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x10b75f6a8>
Traceback (most recent call last):
File "/Users/rajababu/anaconda/lib/python3.6/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/Users/rajababu/anaconda/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 113, in inner_run
autoreload.raise_last_exception()
File "/Users/rajababu/anaconda/lib/python3.6/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "/Users/rajababu/anaconda/lib/python3.6/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/Users/rajababu/anaconda/lib/python3.6/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/Users/rajababu/anaconda/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/rajababu/anaconda/lib/python3.6/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/Users/rajababu/anaconda/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/Users/rajababu/anaconda/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'import_export'
I think import_export is not in your INSTALLED_APPS.
Install import_export with pip
pip install django-import-export
and try again.
You need to install the import_export plugin. You can do this in PyCharm using File > Settings > Project Interpreter and press the "+" icon (search for it and install it). Make sure to add import_export to your INSTALLED_APPS variable in your settings as well.

Categories

Resources