No handlers could be found for logger "django_facebook.models" - django-facebook

while installing django_facebook, i got an error :
Validating models...
No handlers could be found for logger "django_facebook.models"
Unhandled exception in thread started by <function wrapper at 0x1032a5758>
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/django/utils/autoreload.py", line 93, in wrapper
fn(*args, **kwargs)
File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 101, in inner_run
self.validate(display_num_errors=True)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 310, in validate
num_errors = get_validation_errors(s, app)
File "/Library/Python/2.7/site-packages/django/core/management/validation.py", line 113, in get_validation_errors
from django.utils.image import Image
File "/Library/Python/2.7/site-packages/django/utils/image.py", line 154, in <module>
Image, _imaging, ImageFile = _detect_image_library()
File "/Library/Python/2.7/site-packages/django/utils/image.py", line 108, in _detect_image_library
_("Neither Pillow nor PIL could be imported: %s") % err
django.core.exceptions.ImproperlyConfigured: Neither Pillow nor PIL could be imported: No module named Image
It is a pure django project created by pycharm. I was following the document of django_facebook, installation section. What I do is just get facebook app and type the code 'django_facebook' in INSTALLED_APP in settings.py.
It's same results when syncdb also.
I'm using python-2.7.5 and django-1.6.5.
I can't find any answer to solve this. anybody knows this?

Regarding the warningNo handlers could be found for logger "django_facebook.models" and not the error. This question came up on search for that warning, thought this would be useful for others.
django-facebook outputs logs when in operation, just like other django components do. You have to tell Django what you want to do with these messages. In django terminology the app outputs some messages as a logger without needing to know what to do with them, you have to then patch these to a handler which doesn't know anything about your use case, but does know about sending emails/texts/carrier pigeons.
In your settings.py file find LOGGING=..., in the loggers dict you will have to specify what handlers you want to handle the output from django-facebook.
For more information see the docs on logging https://djangoproject.com/en/dev/topics/logging/
My logging variable looks like this, notice the bit at the bottom:
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
},
},
'loggers': {
'django.request': {
'handlers': ['mail_admins','console'],
'level': 'ERROR',
'propagate': True,
},
'django_facebook.models': {
'handlers': ['mail_admins','console'],
'level': 'ERROR',
'propagate': True,
}
}
}

You could try pip install pillow

Related

electron-forge #maker-dmg how to change icon positions in the dmg installer

I have been trying to modify some parameters in the maker-dmg, so far I got all I wanted but the icon position.
this is what I have at the moment:
name: "#electron-forge/maker-dmg",
config: {
title: "Gallery",
background: "src/assets/installer-assets/installBackground.png",
format: "ULFO",
icon: "src/assets/installer-assets/brand-icon.icns",
contents: [
{ x: 192, y: 344, type: "file", path: "Gallery.app" },
{ x: 428, y: 344, type: "link", path: "/Applications" }
]
}
but I am getting an error saying it can't find the Gallery.app.
An error occured while making for target: dmg
"Gallery.app" not found at: /var/folders/07/rvgsd3wx7_949217htsn84pw0000gn/T/Gallery.app
I know that the maker only forwards information to the appdmg library.
I have been going through their documentation, all I found is that all are treated as relative paths.
Basically I don't know what is the temporary mounting location, I only wanted to specify the x and y variables from the content object, but it forces me to specify type and path.
Has anyone changed the dmg style before? Please any help is highly appreciated.
PD. this works when I mount a dmg before without specify content and then I add content like:
{ x: 192, y: 344, type: "file", path: "/Volumes/Gallery/Gallery.app" },
But once I eject it and update the forge config to include the above line It breaks.
If anyone going through the same bs, just used process.cwd().
See example:
contents: [
{
x: 192,
y: 240,
type: "file",
path: `${process.cwd()}/out/Gallery-darwin-x64/Gallery.app`
},
{ x: 466, y: 240, type: "link", path: "/Applications" }
]
and I can finally play around with icon positions! Happy coding.

karma-typescript: import JS file with Async keyword

I'm using karma-typescript, with this karma config file :
karmaTypescriptConfig: {
compilerOptions: {
target: "es5",
lib: ["dom", "es2015", "es2017"]
},
bundlerOptions: {
transforms: [require("karma-typescript-es6-transform")()]
}
},
In my spec files, I have this code :
import {} from './local/lib.js'
In my lib.js, I have this code :
async function() {}
When executing my tests with npm test, I have this error :
ERROR [source-reader.karma-typescript] Error parsing code: Unexpected token (X:Y) in /local/lib.js
If I remove the async keyword, everything is alright.
How can I edit my karma config file to fix the error ?
According to an issue in the Github of the karma-typescript package (https://github.com/monounity/karma-typescript/issues/344), there is an undocumented flag which may help you test code which contains ES2017 code:
karmaTypescriptConfig: {
compilerOptions: {
target: "es5",
lib: ["dom", "es2015", "es2017"]
},
bundlerOptions: {
acornOptions: {
ecmaVersion: 8,
},
transforms: [require("karma-typescript-es6-transform")()]
}
},
This flag made appear our issues with the async keyword. However, there is still an issue with the spread syntax (...array) in our code, even using this flag. If anyone knows an answer how to also fix that, I will happily extend my answer.

Falcon (Waitress) tutorial module object is not callable

So I am going through Falcon tutorial on windows 10 with venv
falcon==1.4.1
waitress==1.1.0
User guide went well but it was served with:
httpd = simple_server.make_server('127.0.0.1', 8000, app)
httpd.serve_forever()
The tutorial works with two files for now:
resource.py:
import json
import falcon
class Resource(object):
def on_get(self, req, resp):
doc = {
'images': [
{
'href': '/images/1eaf6ef1-7f2d-4ecc-a8d5-6e8adba7cc0e.png'
}
]
}
resp.body = json.dumps(doc, ensure_ascii=False)
resp.status = falcon.HTTP_200
app.py:
import falcon
from .images import Resource
api = application = falcon.API()
images = Resource()
api.add_route('/images', images)
waitress initiated with:
waitress-serve --port=8000 look:app
request made with:
http localhost:8000/images
error response:
ERROR:waitress:Exception when serving /images Traceback (most recent
call last): File
"c:\users\ivan\dev\py\projects\falcon\look.venv\lib\site-packages\waitress\channel.py",
line 338, in service
task.service() File "c:\users\ivan\dev\py\projects\falcon\look.venv\lib\site-packages\waitress\task.py",
line 169, in service
self.execute() File "c:\users\ivan\dev\py\projects\falcon\look.venv\lib\site-packages\waitress\task.py",
line 399, in execute
app_iter = self.channel.server.application(env, start_response) TypeError: 'module' object is not callable
Any ideas / inputs how to overcome this ?
Found an issue, the tutorial in falcon framework got it wrong with the waitress command.
Here is the related github issue.
The command should be:
waitress-serve --port=8000 look.app:api

Electron js error - file not found

I have a electron app, so in my dashboard page i am getting an error look like this
Error: Unhandled "error" event.(File not found)
I am using tradingview widget.
var widget = new TradingView.widget({
// debug: true, // uncomment this line to see Library errors and warnings in the console
fullscreen: true,
symbol: 'AA',
interval: 'D',
container_id: "tv_chart_container",
// BEWARE: no trailing slash is expected in feed URL
datafeed: new Datafeeds.UDFCompatibleDatafeed("http://abc.loc/api"),
library_path: "../../assets/charting_library/",
locale: "en",
// Regression Trend-related functionality is not implemented yet, so it's hidden for a while
drawings_access: { type: 'black', tools: [ { name: "Regression Trend" } ] },
disabled_features: ["use_localstorage_for_settings"],
enabled_features: ["study_templates"],
charts_storage_url: 'http://saveload.tradingview.com',
charts_storage_api_version: "1.1",
client_id: 'tradingview.com',
user_id: 'public_user_id'
});
How can I get the file name which can not be found. Thanks!

raven - sentry + django = No servers configured, and sentry not installed. Cannot send message

I have a sentry server that works ok.
raven test <dnstoserver> -> Sending a test message... success!
I have a dev machine with django 1.3 and raven 1.93.
In the django project I have this:
setting.py:
SENTRY_KEY=<secretkey>
SENTRY_DNS=<dnstoserver>
INSTALLED_APPS = (
'bar',
'foo',
'raven.contrib.django',
)
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'root': {
'level': 'WARNING',
'handlers': ['sentry'],
},
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
},
},
'handlers': {
'sentry': {
'level': 'ERROR',
'class': 'raven.contrib.django.handlers.SentryHandler',
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
}
},
'loggers': {
'django.db.backends': {
'level': 'ERROR',
'handlers': ['console'],
'propagate': False,
},
'raven': {
'level': 'DEBUG',
'handlers': ['console', 'sentry'],
'propagate': False,
},
},
}
Mind the absence of 'sentry' in the installed_apps. This is intentionally, since sentry is the server and should not be on a client!
views.py (in a view):
import logging
logger = logging.getLogger("raven")
logger.error("test")
When I run the view I get on the console:
No servers configured, and sentry not installed. Cannot send message
Why, and how to fix?
Were you really setting SENTRY_DNS or SENTRY_DSN?
When you set SENTRY_DSN the instantiation of the major config variables happens automatically (including SENTRY_SERVERS, SENTRY_PUBLIC_KEY, SENTRY_SECRET_KEY, and SENTRY_PROJECT)
The problem was in the construction of the raven DjangoClient. It did not get passed any servers, and couldn't find sentry config to steal that config from.
I added in the settings.py:
SENTRY_SERVERS=<dnstoserver>
Console now outputs this every time raven is called:
INFO 2012-06-21 05:33:19,831 base 4323 140735075462336 Configuring Raven for host: <dnstoserver>
But it works like a charm! Messages in sentry...
BTW. for all the undocumented settings take a look in raven.contrib.django.models.get_client()
I suggest to use:
SENTRY_DSN = 'http://user:password#<domain>:<port>/<project_id>'
And in APPS_INSTALLED add:
'raven.contrib.django.raven_compat'
Also take a look at this guide:
http://code.fetzig.at/post/18607051916/sentry-and-raven-setup-for-django-projects

Resources