I am trying to upgrade Wagtail from 1.13 to 2.0 and I get this error when trying to migrate:
RuntimeError: Model class wagtail.wagtailcore.models.Site doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
And log is:
[...]
File "C: \ Program Files \ Python36 \ lib \ site-packages \ wagtail \ wagtailcore \ blocks \ field_block.py", line 16, in <module>
from wagtail.wagtailcore.rich_text import RichText
File "C: \ Program Files \ Python36 \ lib \ site-packages \ wagtail \ wagtailcore \ rich_text.py", line 10, in <module>
from wagtail.wagtailcore.models import Page
File "C: \ Program Files \ Python36 \ lib \ site-packages \ wagtail \ wagtailcore \ models.py", line 54, in <module>
class Site (models.Model):
File "C: \ Program Files \ Python36 \ lib \ site-packages \ django \ db \ models \ base.py", line 118, in __new__
"INSTALLED_APPS." % (module, name)
RuntimeError: Model class wagtail.wagtailcore.models.Site doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
I have previously installed everything necessary for the update and I have passed the script to rename the changed fields.
In the log you can see that the path that should point to the core actually points to the old version (wagtailcore) instead of "core":
C: \ Program Files \ Python36 \ lib \ site-packages \ wagtail \ wagtailcore \ models.py
I think all the problems come from here, how do I do to django to look in the correct folder?
UPDATE:
I tried to uninstall with pip uninstall wagtail but some folders weren't deleted:
result post uninstall
And command throws this error:
Exception:
Traceback (most recent call last):
File "c:\program files\python36\lib\shutil.py", line 550, in move
os.rename(src, real_dst)
FileNotFoundError: [WinError 3] El sistema no puede encontrar la ruta especificada: 'c:\\program files\\python36\\lib\\site-packages\\wagtail\\tests\\testapp\\migrations\\__pycache__\\0005_customrichblockfieldpage_customrichtextfieldpage_defaultrichblockfieldpage_defaultrichtextfieldpage.cpython-36.pyc' -> 'C:\\Users\\plata\\AppData\\Local\\Temp\\pip-uninstall-v6wl_qyt\\program files\\python36\\lib\\site-packages\\wagtail\\tests\\testapp\\migrations\\__pycache__\\0005_customrichblockfieldpage_customrichtextfieldpage_defaultrichblockfieldpage_defaultrichtextfieldpage.cpython-36.pyc'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\program files\python36\lib\site-packages\pip\_internal\cli\base_command.py", line 143, in main
status = self.run(options, args)
File "c:\program files\python36\lib\site-packages\pip\_internal\commands\uninstall.py", line 75, in run
auto_confirm=options.yes, verbose=self.verbosity > 0,
File "c:\program files\python36\lib\site-packages\pip\_internal\req\req_install.py", line 683, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "c:\program files\python36\lib\site-packages\pip\_internal\req\req_uninstall.py", line 224, in remove
renames(path, new_path)
File "c:\program files\python36\lib\site-packages\pip\_internal\utils\misc.py", line 280, in renames
shutil.move(old, new)
File "c:\program files\python36\lib\shutil.py", line 564, in move
copy_function(src, real_dst)
File "c:\program files\python36\lib\shutil.py", line 263, in copy2
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "c:\program files\python36\lib\shutil.py", line 121, in copyfile
with open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\plata\\AppData\\Local\\Temp\\pip-uninstall-v6wl_qyt\\program files\\python36\\lib\\site-packages\\wagtail\\tests\\testapp\\migrations\\__pycache__\\0005_customrichblockfieldpage_customrichtextfieldpage_defaultrichblockfieldpage_defaultrichtextfieldpage.cpython-36.pyc'
The wagtailcore app folder doesn't exist at all in Wagtail 2.0's codebase, so it looks like you still have the old version of Wagtail installed. Try running pip uninstall wagtail, and confirm that the C:\Program Files\Python36\lib\site-packages\wagtail folder has been properly deleted before running pip install wagtail==2.0.2.
Related
I'm dockerizing Django 2.2 application and using Pipenv for environment management.
I want to use SQS as broker with Django celery.
I have installed the pycurl library using Pipenv
[packages]
...
pycurl = "*"
When I run celery locally
pipenv run celery -A qcg worker -l info
It works but when I run using docker image
docker run app:latest celery -A qcg worker -l info
It gives error
ImportError: The curl client requires the pycurl library.
The command in Docerkfile used to install dependencies
RUN set -ex \
&& BUILD_DEPS=" \
build-essential \
libpcre3-dev \
libpq-dev \
libcurl4-openssl-dev libssl-dev \
" \
&& apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \
&& export PYCURL_SSL_LIBRARY=nss \
&& pipenv install --deploy --system \
\
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS
\
&& rm -rf /var/lib/apt/lists/*
Complete error log
[2020-05-25 17:16:22,216: CRITICAL/MainProcess] Unrecoverable error: ImportError('The curl client requires the pycurl library.')
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/kombu/asynchronous/http/__init__.py", line 20, in get_client
return hub._current_http_client
AttributeError: 'Hub' object has no attribute '_current_http_client'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/celery/worker/worker.py", line 205, in start
self.blueprint.start(self)
File "/usr/local/lib/python3.7/site-packages/celery/bootsteps.py", line 119, in start
step.start(parent)
File "/usr/local/lib/python3.7/site-packages/celery/bootsteps.py", line 369, in start
return self.obj.start()
File "/usr/local/lib/python3.7/site-packages/celery/worker/consumer/consumer.py", line 318, in start
blueprint.start(self)
File "/usr/local/lib/python3.7/site-packages/celery/bootsteps.py", line 119, in start
step.start(parent)
File "/usr/local/lib/python3.7/site-packages/celery/worker/consumer/consumer.py", line 599, in start
c.loop(*c.loop_args())
File "/usr/local/lib/python3.7/site-packages/celery/worker/loops.py", line 83, in asynloop
next(loop)
File "/usr/local/lib/python3.7/site-packages/kombu/asynchronous/hub.py", line 301, in create_loop
item()
File "/usr/local/lib/python3.7/site-packages/vine/promises.py", line 170, in __call__
return self.throw()
File "/usr/local/lib/python3.7/site-packages/vine/promises.py", line 167, in __call__
retval = fun(*final_args, **final_kwargs)
File "/usr/local/lib/python3.7/site-packages/kombu/transport/SQS.py", line 390, in _schedule_queue
queue, callback=promise(self._loop1, (queue,)),
File "/usr/local/lib/python3.7/site-packages/kombu/transport/SQS.py", line 406, in _get_bulk_async
return self._get_async(queue, maxcount, callback=callback)
File "/usr/local/lib/python3.7/site-packages/kombu/transport/SQS.py", line 416, in _get_async
qname, count=count, connection=self.asynsqs(queue=qname),
File "/usr/local/lib/python3.7/site-packages/kombu/transport/SQS.py", line 566, in asynsqs
region=self.region
File "/usr/local/lib/python3.7/site-packages/kombu/asynchronous/aws/sqs/connection.py", line 27, in __init__
**kwargs
File "/usr/local/lib/python3.7/site-packages/kombu/asynchronous/aws/connection.py", line 194, in __init__
**http_client_params)
File "/usr/local/lib/python3.7/site-packages/kombu/asynchronous/aws/connection.py", line 151, in __init__
self._httpclient = http_client or get_client()
File "/usr/local/lib/python3.7/site-packages/kombu/asynchronous/http/__init__.py", line 22, in get_client
client = hub._current_http_client = Client(hub, **kwargs)
File "/usr/local/lib/python3.7/site-packages/kombu/asynchronous/http/__init__.py", line 13, in Client
return CurlClient(hub, **kwargs)
File "/usr/local/lib/python3.7/site-packages/kombu/asynchronous/http/curl.py", line 43, in __init__
raise ImportError('The curl client requires the pycurl library.')
ImportError: The curl client requires the pycurl library.
I was getting the same error and this worked for me: pip install celery[sqs]
This issue was with the libcurl4-nss-dev libssl-dev installation.
In the following installation script
RUN set -ex \
&& BUILD_DEPS=" \
build-essential \
libpcre3-dev \
libpq-dev \
libcurl4-openssl-dev libssl-dev \
" \
&& apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \
&& export PYCURL_SSL_LIBRARY=nss \
&& pipenv install --deploy --system \
\
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS
\
&& rm -rf /var/lib/apt/lists/* ```
The libcurl4-nss-dev libssl-dev installation is removed after the Pipenv install. So the package library couldn't be located.
After separating installation of libcurl4-nss-dev libssl-dev works for me.
RUN apt-get install -y --no-install-recommends libcurl4-nss-dev libssl-dev
I am getting this error when trying to configure Supervisor for a Django application on a VPS. So when I look at the error log it seems like it can't find the directory but I don't know what I am doing wrong here.
The path is:
/home/webconexus/portfolio
(portfolio) webconexus#wagtail-portfolio:~/portfolio$ sudo supervisorctl status
portfolio FATAL Exited too quickly (process log may have details
This is my gunicorn_start file:
#!/bin/bash
NAME="portfolio"
DIR=/home/webconexus/portfolio
USER=webconexus
GROUP=webconexus
WORKERS=3
BIND=unix:/home/webconexus/portfolio/run/gunicorn.sock
DJANGO_SETTINGS_MODULE=portfolio.settings
DJANGO_WSGI_MODULE=portfolio.wsgi
LOG_LEVEL=error
cd $DIR
source ../bin/activate
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DIR:$PYTHONPATH
exec ../bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $WORKERS \
--user=$USER \
--group=$GROUP \
--bind=$BIND \
--log-level=$LOG_LEVEL \
--log-file=-
This is my conf file:
[program:portfolio]
command=/home/webconexus/portfolio/bin/gunicorn_start
directory=/home/webconexus/portfolio
user=webconexus
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/home/webconexus/portfolio/logs/gunicorn-error.log
The new error log:
[2019-02-07 12:58:20 +0000] [3835] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/workers/base.py", line 129, in init_process
self.load_wsgi()
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
return self.load_wsgiapp()
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File "/home/webconexus/portfolio/lib/python3.5/site-packages/gunicorn/util.py", line 350, in import_app
__import__(module)
ImportError: No module named 'portfolio'
No need to go back to ..
Try this
#!/bin/bash
NAME="portfolio"
DIR=/home/webconexus/portfolio
USER=webconexus
GROUP=webconexus
WORKERS=3
BIND=unix:/home/webconexus/portfolio/run/gunicorn.sock
DJANGO_SETTINGS_MODULE=portfolio.settings
DJANGO_WSGI_MODULE=portfolio.wsgi
LOG_LEVEL=error
cd $DIR
source ./bin/activate
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DIR:$PYTHONPATH
exec ./bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $WORKERS \
--user=$USER \
--group=$GROUP \
--bind=$BIND \
--log-level=$LOG_LEVEL \
--log-file=-
I'm running tensorflow in Ubuntu (in VirtualEnv).
I want to create training model ...( using retrain.py to train the model )..
Github code link ==> https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/image_retraining/retrain.py
I tried to use command to run in terminal
python image_retraining/retrain.py \
--bottleneck_dir= /tf_files/bottlenecks \
--how_many_training_steps 100 \
--model_dir= /tf_files/inception \
--output_graph= /tf_files/retrained_graph.pb \
--output_labels= /tf_files/retrained_labels.txt \
--image_dir = /Image_Processing/theory/Green
I'm getting error. How to read that error and how to resolve it..
Traceback (most recent call last):
File "image_retraining/retrain.py", line 1061, in <module>
tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
File "/Image_Processing/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 43, in run
sys.exit(main(sys.argv[:1] + flags_passthrough))
File "image_retraining/retrain.py", line 777, in main
maybe_download_and_extract()
File "image_retraining/retrain.py", line 288, in maybe_download_and_extract
os.makedirs(dest_directory)
File "/Image_Processing/tensorflow/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 2] No such file or directory: ''
Note :- I'm new in tensorflow and just started to use it..
while running retrain.py, you do not have to specify all the parameters.
Just specify
python /path_to_file/retrain.py --img_dir /dir_containing_subfolders_of_images
while running the code and it will use default paths for remaining arguments. eg. /tmp/some_dir_or_file for most cases.
If you want to specify custom locations create the desired directories and specify those paths.
eg.
python /path_to_file/retrain.py
--img_dir /dir_containing_subfolders_of_images
--how_many_training_steps number_of_steps
--output_graph /dirPath_to_store_output_graph/file_name.pb
--output_labels /dirPath_to_store_output_labels/file_name.txt
Here's the error:
Traceback (most recent call last):
File "/var/apps/tango/envs/tango-env/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 187, in __call__
self.load_middleware()
File "/var/apps/tango/envs/tango-env/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 45, in load_middleware
mw_class = import_by_path(middleware_path)
File "/var/apps/tango/envs/tango-env/local/lib/python2.7/site-packages/django/utils/module_loading.py", line 21, in import_by_path
module = import_module(module_path)
File "/var/apps/tango/envs/tango-env/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/var/apps/tango/envs/tango-env/local/lib/python2.7/site-packages/django/middleware/doc.py", line 4, in <module>
warnings.warn(__doc__, PendingDeprecationWarning, stacklevel=2)
TypeError: expected string or buffer
TypeError: expected string or buffer
Tango is the user I created specifically for this project.
I'm using upstart so in /etc/init/tango-wsgi.conf looks like:
exec /var/apps/tango/envs/tango-env/bin/uwsgi \
--uid tango \
--home /var/apps/tango/envs/tango-env \
--pythonpath /var/apps/tango/tango/src \
--wsgi-file /var/apps/tango/tango/src/tango_cms/wsgi.py \
--socket /tmp/tango-uwsgi.sock \
--chmod-socket \
--logdate \
--optimize 2 \
--processes 2 \
--master \
--logto /var/apps/tango/logs/uwsgi.log
UPDATE:
My nginx.conf has following entry:
location / {
uwsgi_pass unix:/tmp/tango-uwsgi.sock;
include /etc/nginx/uwsgi_params;
}
Please help.
Same problem here. I fixed it deleting the following line on tango-wsgi.conf file:
--optimize 2 \
Optimize allows some kind of python optimization: More info
Not sure why it's an error, you could try removing "XViewMiddleware" if it's installed.
I have a django project set up, with gunicorn. I have the following gunicorn_start:
#! /bin/bash
NAME="ostabs2"
DJANGODIR=/srv/osmium/ostabs2
SOCKFILE=/srv/osmium/run/gunicorn.sock
USER=tabuser
GROUP=webapps
NUM_WORKERS=3
DJANGO_SETTINGS_MODULE=ostabs2.settings
DANGO_WSGI_MODULE=ostabs2.wsgi
echo "Starting $NAME as 'whoami'"
cd $DJANGODIR
source /srv/osmium/venv/bin/activate
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DJANGODIR:$PYTHONPATH
exec gunicorn ${DJANGO_WSGI_MODULE}:application \
--preload \
--name $NAME \
--workers $NUM_WORKERS \
--user=$USER --group=$GROUP \
--log-level=debug \
--bind=unix:$SOCKFILE \
--log-file=ostabsgun.log
Running
gunicorn ostabs2.wsgi:application
on the command line works fine, but the gunicorn_start script gives:
Traceback (most recent call last):
File "/srv/osmium/venv/bin/gunicorn", line 11, in <module>
sys.exit(run())
File "/srv/osmium/venv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
File "/srv/osmium/venv/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 185, in run
super(Application, self).run()
File "/srv/osmium/venv/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 71, in run
Arbiter(self).run()
File "/srv/osmium/venv/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 57, in __init__
self.setup(app)
File "/srv/osmium/venv/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 113, in setup
self.app.wsgi()
File "/srv/osmium/venv/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 66, in wsgi
self.callable = self.load()
File "/srv/osmium/venv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/srv/osmium/venv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/srv/osmium/venv/local/lib/python2.7/site-packages/gunicorn/util.py", line 356, in import_app
__import__(module)
ValueError: Empty module name
What would cause this error? Is there an error in the project, or a missing dependency? I have checked user permissions on all files and directories and tabuser has full read/write access. How can I track down the cause of this problem?
UPDATE: I have followed the advice from this question, the database definitions are correct (I can run syyncdb both locally and on the server). There are no empty strings in the installed apps section, and I have removed references throughout the app to libraries which are no longer used.
Is there anything else which can cause this error?