I get satchmo to try, but I have a great problem at first try, and I don't understand whats wrong.
When I making $ python clonesatchmo.py into clear django project, it trows an error:
$ python clonesatchmo.py
Creating the Satchmo Application
Customizing the files
Performing initial data synching
Traceback (most recent call last):
File "manage.py", line 18, in <module>
from django.core.management import execute_manager
ImportError: cannot import name execute_manager
Traceback (most recent call last):
File "manage.py", line 18, in <module>
from django.core.management import execute_manager
ImportError: cannot import name execute_manager
Error: Can not copy the static files.
Error: Can not syncdb.
AND creates a store folder.
trying smth like this is working!!:
$ python manage.py shell
>>> import os, sys
>>> print sys.executable
/some/path/to/python
>>> os.system('bash')
$ /some/path/to/python manage.py validate
# this is NOT fail on "from django.core.management import execute_manager"
I have Django 1.6 and Satchmo 0.9.3, python 2.7.5
(I do not use virtualenv)
Replace the contents of manage.py with the following (from a new django 1.6 project).
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "<app>.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
execute_manager was put on the deprecation path as part of the project layout refactor in Django 1.4 https://docs.djangoproject.com/en/1.4/releases/1.4/#django-core-management-execute-manager. Per the deprecation policy that means that the code for execute_manager has been completely removed in 1.6. If you are seeing this import error then the version of Satchmo you are using has not been updated to be compatible with Django 1.6.
Related
When I launch a Django project in a local server, It doesn't work with the errors below,
and then, I checked the directory of conf(/Users/apple/GoogleDrive/project_django/venv/lib/python3.7/site-packages/django/conf) and found that global_settings.py doesn't exist in that directory.
in that case, how should I do?
do I have to make the global_settings.py my self in there with this code? or will I be able to solve another way?
Would you mind telling me how should I solve this problem?
Thank you in advance.
__init__.py(global_settings has red lile)
The structure of conf directory
error code after I add global_settings.py in the conf folder my self
Traceback (most recent call last):
File "/Users/apple/GoogleDrive/project_django/harvest_timer/manage.py", line 10, in main
from django.core.management import execute_from_command_line
File "/Users/apple/GoogleDrive/project_django/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 13, in <module>
from django.core.management.base import (
File "/Users/apple/GoogleDrive/project_django/venv/lib/python3.7/site-packages/django/core/management/base.py", line 11, in <module>
from django.core import checks
File "/Users/apple/GoogleDrive/project_django/venv/lib/python3.7/site-packages/django/core/checks/__init__.py", line 8, in <module>
import django.core.checks.caches # NOQA isort:skip
File "/Users/apple/GoogleDrive/project_django/venv/lib/python3.7/site-packages/django/core/checks/caches.py", line 2, in <module>
from django.core.cache import DEFAULT_CACHE_ALIAS
File "/Users/apple/GoogleDrive/project_django/venv/lib/python3.7/site-packages/django/core/cache/__init__.py", line 18, in <module>
from django.core import signals
File "/Users/apple/GoogleDrive/project_django/venv/lib/python3.7/site-packages/django/core/signals.py", line 1, in <module>
from django.dispatch import Signal
File "/Users/apple/GoogleDrive/project_django/venv/lib/python3.7/site-packages/django/dispatch/__init__.py", line 9, in <module>
from django.dispatch.dispatcher import Signal, receiver # NOQA
File "/Users/apple/GoogleDrive/project_django/venv/lib/python3.7/site-packages/django/dispatch/dispatcher.py", line 4, in <module>
from django.utils.inspect import func_accepts_kwargs
ModuleNotFoundError: No module named 'django.utils.inspect'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/apple/GoogleDrive/project_django/project/manage.py", line 21, in <module>
main()
File "/Users/apple/GoogleDrive/project_django/project/manage.py", line 16, in main
) from exc
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
error code when I run the project using Pycharm
Traceback (most recent call last):
File "/Users/apple/GoogleDrive/project_django/project/manage.py", line 10, in main
from django.core.management import execute_from_command_line
File "/Users/apple/GoogleDrive/project_django/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 11, in <module>
from django.conf import settings
File "/Users/apple/GoogleDrive/project_django/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 17, in <module>
from django.conf import global_settings
ImportError: cannot import name 'global_settings' from 'django.conf' (/Users/apple/GoogleDrive/project_django/venv/lib/python3.7/site-packages/django/conf/__init__.py)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/apple/GoogleDrive/project_django/project/manage.py", line 21, in <module>
main()
File "/Users/apple/GoogleDrive/project_django/project/manage.py", line 16, in main
) from exc
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
error code when I run the project using the terminal
Traceback (most recent call last):
File "manage.py", line 10, in main
from django.core.management import execute_from_command_line
File "/Users/apple/GoogleDrive/project_django/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 11, in <module>
from django.conf import settings
File "/Users/apple/GoogleDrive/project_django/venv/lib/python3.7/site-packages/django/conf/__init__.py", line 17, in <module>
from django.conf import global_settings
ImportError: cannot import name 'global_settings' from 'django.conf' (/Users/apple/GoogleDrive/project_django/venv/lib/python3.7/site-packages/django/conf/__init__.py)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 16, in main
) from exc
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
manage.py
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()
Python Console
import sys;
...
...print(sys.path)
['/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev', '/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/third_party/thriftpy', '/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload', '/Users/apple/GoogleDrive/project_django/venv/lib/python3.7/site-packages', '/Users/apple/GoogleDrive/project_django']
Run/Debug Configurations in Pycharm
[ Script path ]: /Users/apple/GoogleDrive/project_django/project/manage.py
[ Parameters ]:runserver
[ Environment ] variables:PYTHONUNBUFFERED=1;DJANGO_SETTINGS_MODULE=project.settings_dev
[ Python interpreter ]:Python 3.7(project_django) ~/GoogleDrive/project_django/venv/bin/python
[ Working directory ]:/Users/apple/GoogleDrive/project_django/project
Development environment
Mac: mojave 10.14.6
Python: 3.7.5
Django: 2.2.2
Pycharm: 2019.3.1 (community edition)
No you shouldn't create global_settings yourself.
I see you are using Pycharm, try your Python virtualenv interpreter to Pycharm with these instructions: https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html
Then try to start the django project from Pycharm
Assuming you have Django configured in your system.
I think what you are missing is activating your virtual environment.
cd to Django path. /Users/apple/GoogleDrive/project_django/venv/
Run source bin/activate to activate your virtual environment
then cd to your project. All should be working fine then.
I am doing a lot of assumptions though. I am not sure of how exactly you have your development environment setup for django.
I just went to run my Django development server in the Django project that I'm working on and I got this...
(baseballwebenv) C:\DjangoProjects\BaseballWebsite\baseballweb>python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
File "C:\Users\Nick\Anaconda3\envs\baseballwebenv\lib\site-packages\django\__init__.py", line 1, in <module>
from django.utils.version import get_version
File "C:\Users\Nick\Anaconda3\envs\baseballwebenv\lib\site-packages\django\utils\version.py", line 4, in <module>
import subprocess
File "c:\users\nick\anaconda3\Lib\subprocess.py", line 178, in <module>
from _winapi import (CREATE_NEW_CONSOLE, CREATE_NEW_PROCESS_GROUP,
ImportError: cannot import name 'ABOVE_NORMAL_PRIORITY_CLASS'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 14, in <module>
) from exc
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
As you can see I am by my runserver command, I am in my virtual environment. I recently upgraded all of my Anaconda packages, thinking everything was protected in the virtual environment. I would suspect this problem is related to that, but I'm not sure. How do I get my project up and running again? If someone wants to see certain files, I can add those as well.
I'm getting the following error trying to run Django using apache:
mod_wsgi (pid=3294): Target WSGI script '/www/cocurate2_dev/startup.wsgi' cannot be loaded as Python module.
mod_wsgi (pid=3294): Exception occurred processing WSGI script '/www/cocurate2_dev/startup.wsgi'.
Traceback (most recent call last):
File "/www/cocurate2_dev/startup.wsgi", line 3, in <module>
from django.core.wsgi import get_wsgi_application
File "/www/cocurate2_dev/components/lib/python2.7/site-packages/django/core/wsgi.py", line 2, in <module>
from django.core.handlers.wsgi import WSGIHandler
File "/www/cocurate2_dev/components/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 10, in <module>
from django import http
File "/www/cocurate2_dev/components/lib/python2.7/site-packages/django/http/__init__.py", line 5, in <module>
from django.http.response import (
File "/www/cocurate2_dev/components/lib/python2.7/site-packages/django/http/response.py", line 13, in <module>
from django.core.serializers.json import DjangoJSONEncoder
File "/www/cocurate2_dev/components/lib/python2.7/site-packages/django/core/serializers/__init__.py", line 23, in <module>
from django.core.serializers.base import SerializerDoesNotExist
File "/www/cocurate2_dev/components/lib/python2.7/site-packages/django/core/serializers/base.py", line 4, in <module>
from django.db import models
File "/www/cocurate2_dev/components/lib/python2.7/site-packages/django/db/models/__init__.py", line 4, in <module>
from django.db.models import signals # NOQA
ImportError: cannot import name signals
Everything works find when using manage.py runserver. I've updated the wsgi file to be the same as the default one from django 1.10.
I've checked that signals.py exists inside django, I've also cleaned .pyc files.
It turns out there actually was a file missing from the django installation for various reasons, it just wasn't signals.py but rather something it imported.
You can debug problems like this by running python with -v or -vv switch to make output verbose. I was able to see that it was trying to import another file from signals.py.
I had this error when my Django 1.10 install was downgraded to Django 1.6 by a third party.
After removing it and re-installing the correct version of Django, everything worked like a champ.
I'm using python 2.7 and am having trouble running the server. I have entered
python2.7 manage.py runserver and got the following error message
Traceback (most recent call last):
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
ImportError: No module named django.core.management
I went into the manage.py portion of the app and can see that I have
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myesite.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
can someone please explain what I have done wrong or what I need to do?
Do you have the django package installed? go to your command line and type "pip list" and see if django is in the list.
If it is not, "pip install django" should allow you to download and install the package.
every time I tried to build a django project. I have no initialized files like manage.py in my project.
Then I tried to create the project on command line, I got this:
C:\Python34\Lib\site-packages\Django-1.9.3-py3.4.egg\django\bin> python .\django-admin.py startproject "MySite"
Traceback (most recent call last):
File ".\django-admin.py", line 2, in <module>
from django.core import management
File "C:\Python34\lib\site-packages\django-1.9.3-py3.4.egg\django\core\management\__init__.py", line 10, in <module>
from django.apps import apps
File "C:\Python34\lib\site-packages\django-1.9.3-py3.4.egg\django\apps\__init__.py", line 1, in <module>
from .config import AppConfig
File "C:\Python34\lib\site-packages\django-1.9.3-py3.4.egg\django\apps\config.py", line 6, in <module>
from django.utils.module_loading import module_has_submodule
File "C:\Python34\lib\site-packages\django-1.9.3-py3.4.egg\django\utils\module_loading.py", line 67, in <module>
from importlib.util import find_spec as importlib_find
ImportError: cannot import name 'find_spec'
Somebody could help me? I really appreciate your help.
ps: python3.4, django_1.9
U need to put your code here because it seems you are having too many import errors
You are trying to create a Django project from within your Python installation (C:\Python34\Lib\site-packages\Django-1.9.3-py3.4.egg\django\bin>).
Try going to your home directory and trying there. django-admin should be in C:\Python34\Scripts\ and that should be in your PATH so you should be able to call it from anywhere.
PS Use virtualenv