Spl token not getting minted using spl js library - solana

Here's my code i'm trying to mint spl token using spl js library:
(async () => {
const connection = new web3.Connection(web3.clusterApiUrl("devnet"));
let secretKey = Uint8Array.from([
186, 104, 237, 47, 123, 227, 2, 226, 150, 7, 169, 40, 252, 67, 161, 86, 198,....
183, 130, 31, 174, 135, 153, 46, 227, 154, 125, 20, 79, 209,
]);
const myKeypair = web3.Keypair.fromSecretKey(secretKey);
console.log(myKeypair.publicKey);
mint = await splToken.createMint(
connection,
myKeypair,
myKeypair.publicKey,
null,
9,
splToken.TOKEN_PROGRAM_ID
);
console.log("mint:"+mint);
})();
This is the error im getting:
solana/node_modules/#solana/web3.js/lib/index.cjs.js:1791
const key = signer.publicKey.toString();
^
TypeError: Cannot read properties of undefined (reading 'toString')
at Transaction.sign solana/node_modules/#solana/web3.js/lib/index.cjs.js:1791:36)
at Connection.sendTransaction solana/node_modules/#solana/web3.js/lib/index.cjs.js:9676:21)

those are the parameters for createMint()
#param connection — Connection to use
#param payer — Payer of the transaction and initialization fees
#param mintAuthority — Account or multisig that will control minting
#param freezeAuthority — Optional account or multisig that can freeze token accounts
#param decimals — Location of the decimal place
#param keypair — Optional keypair, defaulting to a new random one
Last one type is Keypair. but you are passing splToken.TOKEN_PROGRAM_ID which is PublicKey. you need to create another keypair for the last arg

Related

Springboot admin 3.x.x doesn't load the page

I am using Spring Boot 3.0.1 with Java 17. For spring boot admin and client, I am using the latest version as follows.
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>3.0.0-M8</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>3.0.0-M8</version>
</dependency>
After the login screen to admin, I get the following. Nothing rendered on the page.
:root {
--main-50: 238, 252, 250;
--main-100: 217, 247, 244;
--main-200: 183, 240, 234;
--main-300: 145, 232, 224;
--main-400: 107, 224, 213;
--main-500: 71, 217, 203;
--main-600: 39, 190, 175;
--main-700: 30, 144, 132;
--main-800: 20, 97, 90;
--main-900: 10, 47, 43;
--bg-color-start: #91E8E0;
--bg-color-stop: #1E9084;
}
.bg-color-start {
transition: 0.4s ease;
stop-color: var(--bg-color-start);
}
.bg-color-stop {
transition: 0.4s ease;
stop-color: var(--bg-color-stop);
}
What am I missing? Is the latest version unstable still?
I think this is the same question like here: https://github.com/codecentric/spring-boot-admin/issues/2218
The css file is used by the login page, but needs authenticated access. So it is loaded after login and then displayed.
Solution is to permit access to the variables.css file like
.requestMatchers(new AntPathRequestMatcher(this.adminServer.path("/variables.css"))).permitAll()
in the spring security config, similar to the static assets.
The SBA Team will check if this is really required or if it can be changed in SBA before final release of 3.0. If it will be needed we'll update the docs.

Django Customer can't be null

I have an issues with the error return 1048, “Column ‘user_id’ cannot be null” and checked the code but can't find any mistake in it, does somebody else have an idea?
…/store/Serializers.py
class Meta:
model = Customer
fields = ['id', 'user_id', 'phone', 'birth_date', 'membership']
…/store/views.py
class CustomerViewSet(CreateModelMixin, RetrieveModelMixin, UpdateModelMixin, GenericViewSet):
queryset = Customer.objects.all()
serializer_class = CustomerSerializer
#action(detail=False, methods=['GET', 'PUT'])
def me(self, request):
(customer, created) = Customer.objects.get_or_create(user_id=request.user.id)
if request.method == 'GET':
serializer = CustomerSerializer(customer)
return Response(serializer.data)
elif request.method == 'PUT':
serializer = CustomerSerializer(customer, data=request.data)
serializer.is_valid(raise_exception=True)
serializer.save()
return Response(serializer.data)
…/store/models.py
class Customer(models.Model):
MEMBERSHIP_BRONZE = ‘B’
MEMBERSHIP_SILVER = ‘S’
MEMBERSHIP_GOLD = ‘G’
MEMBERSHIP_CHOICES = [
(MEMBERSHIP_BRONZE, 'Bronze'),
(MEMBERSHIP_SILVER, 'Silver'),
(MEMBERSHIP_GOLD, 'Gold'),
]
phone = models.CharField(max_length=255)
birth_date = models.DateField(null=True, blank=True)
membership = models.CharField(
max_length=1, choices=MEMBERSHIP_CHOICES, default=MEMBERSHIP_BRONZE)
user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
def str(self):
return f'{self.user.first_name} {self.user.last_name}'
#admin.display(ordering='user__first_name')
def first_name(self):
return self.user.first_name
#admin.display(ordering='user__last_name')
def last_name(self):
return self.user.last_name
class Meta:
ordering = ['user__first_name', 'user__last_name']
…/core/serializers.py
class UserCreateSerializer(BaseUserCreateSerializer):
class Meta(BaseUserCreateSerializer.Meta):
fields = [‘id’, ‘username’, ‘password’, ‘email’, ‘first_name’, ‘last_name’]
class UserSerializer(BaseUserSerializer):
class Meta(BaseUserSerializer.Meta):
fields = [‘id’, ‘username’, ‘email’, ‘first_name’, ‘last_name’]
ERROR MESSAGE!!!
Traceback (most recent call last):
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/core/handlers/exception.py”, line 55, in inner
response = get_response(request)
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/core/handlers/base.py”, line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/views/decorators/csrf.py”, line 54, in wrapped_view
return view_func(*args, **kwargs)
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/rest_framework/viewsets.py”, line 125, in view
return self.dispatch(request, *args, **kwargs)
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/rest_framework/views.py”, line 509, in dispatch
response = self.handle_exception(exc)
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/rest_framework/views.py”, line 469, in handle_exception
self.raise_uncaught_exception(exc)
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/rest_framework/views.py”, line 480, in raise_uncaught_exception
raise exc
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/rest_framework/views.py”, line 506, in dispatch
response = handler(request, *args, **kwargs)
File “/Users/rogerlooser/Documents/Privat_Roger/Schule/Python/storefront/store/views.py”, line 91, in me
(customer, created) = Customer.objects.get_or_create(user_id=request.user.id)
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/manager.py”, line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/query.py”, line 935, in get_or_create
return self.create(**params), True
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/query.py”, line 671, in create
obj.save(force_insert=True, using=self.db)
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/base.py”, line 812, in save
self.save_base(
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/base.py”, line 863, in save_base
updated = self._save_table(
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/base.py”, line 1006, in _save_table
results = self._do_insert(
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/base.py”, line 1047, in _do_insert
return manager._insert(
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/manager.py”, line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/query.py”, line 1790, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/sql/compiler.py”, line 1660, in execute_sql
cursor.execute(sql, params)
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/src/django-debug-toolbar/debug_toolbar/panels/sql/tracking.py”, line 230, in execute
return self._record(self.cursor.execute, sql, params)
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/src/django-debug-toolbar/debug_toolbar/panels/sql/tracking.py”, line 154, in _record
return method(sql, params)
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/backends/utils.py”, line 103, in execute
return super().execute(sql, params)
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/backends/utils.py”, line 67, in execute
return self._execute_with_wrappers(
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/backends/utils.py”, line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/backends/utils.py”, line 89, in _execute
return self.cursor.execute(sql, params)
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/backends/mysql/base.py”, line 80, in execute
raise IntegrityError(*tuple(e.args))
django.db.utils.IntegrityError: (1048, “Column ‘user_id’ cannot be null”)
[26/Dec/2022 15:16:38] “GET /store/customers/me/ HTTP/1.1” 500 206743
/Users/rogerlooser/Documents/Privat_Roger/Schule/Python/storefront/store/views.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks…
Maybe somebody of you guys find the issue

FastAPI + GraphQL getting error NoneType is callable when raise Exception

I'm stuck when trying to raise a validation error with FastAPI + GraphQL (graphene).
I have a resolver code:
class Query(graphene.ObjectType):
list_categories = graphene.List(CategoryGrapheneModel)
get_category = graphene.Field(CategoryGrapheneModel, id=graphene.Argument(graphene.Int, required=True))
#staticmethod
def resolve_list_categories(parent, info):
return Category.all()
#staticmethod
def resolve_get_category(parent, info, id):
try:
category = Category.find_or_fail(id)
return category
except ModelNotFound as ex:
raise Exception('Category not found')
But instead of getting 400 HTTP response with the message I got 500 Internal Server Error with traceback:
Traceback (most recent call last):
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 394, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
return await self.app(scope, receive, send)
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/fastapi/applications.py", line 199, in __call__
await super().__call__(scope, receive, send)
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/applications.py", line 111, in __call__
await self.middleware_stack(scope, receive, send)
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 181, in __call__
raise exc from None
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 159, in __call__
await self.app(scope, receive, _send)
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in __call__
raise exc from None
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/exceptions.py", line 71, in __call__
await self.app(scope, receive, sender)
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/routing.py", line 566, in __call__
await route.handle(scope, receive, send)
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/routing.py", line 227, in handle
await self.app(scope, receive, send)
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/graphql.py", line 52, in __call__
response = await self.handle_graphql(request)
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/graphql.py", line 105, in handle_graphql
[format_graphql_error(err) for err in result.errors]
File "/Users/vitalyradchik/Devel/upwork/tipolim/backend/.venv/lib/python3.9/site-packages/starlette/graphql.py", line 105, in <listcomp>
[format_graphql_error(err) for err in result.errors]
TypeError: 'NoneType' object is not callable
Googling is not gives me a solution. So please help.
Got handled with it.
The problem was in GraphQLApp, there was calling format_graphql_errors that was undefined (None).
To solve a problem I've created a custom child class from GraphQLApp and changed format_graphql_errors to format_error from graphql.error.graphql_error package.
import json
import typing
from starlette.graphql import GraphQLApp
from starlette import status
from starlette.background import BackgroundTasks
from starlette.concurrency import run_in_threadpool
from starlette.requests import Request
from starlette.responses import HTMLResponse, JSONResponse, PlainTextResponse, Response
from starlette.types import Receive, Scope, Send
from graphql.error.graphql_error import format_error
class CustomGraphQLApp(GraphQLApp):
async def handle_graphql(self, request: Request) -> Response:
if request.method in ("GET", "HEAD"):
if "text/html" in request.headers.get("Accept", ""):
if not self.graphiql:
return PlainTextResponse(
"Not Found", status_code=status.HTTP_404_NOT_FOUND
)
return await self.handle_graphiql(request)
data = request.query_params # type: typing.Mapping[str, typing.Any]
elif request.method == "POST":
content_type = request.headers.get("Content-Type", "")
if "application/json" in content_type:
data = await request.json()
elif "application/graphql" in content_type:
body = await request.body()
text = body.decode()
data = {"query": text}
elif "query" in request.query_params:
data = request.query_params
else:
return PlainTextResponse(
"Unsupported Media Type",
status_code=status.HTTP_415_UNSUPPORTED_MEDIA_TYPE,
)
else:
return PlainTextResponse(
"Method Not Allowed", status_code=status.HTTP_405_METHOD_NOT_ALLOWED
)
try:
query = data["query"]
variables = data.get("variables")
operation_name = data.get("operationName")
except KeyError:
return PlainTextResponse(
"No GraphQL query found in the request",
status_code=status.HTTP_400_BAD_REQUEST,
)
background = BackgroundTasks()
context = {"request": request, "background": background}
result = await self.execute(
query, variables=variables, context=context, operation_name=operation_name
)
error_data = (
[format_error(err) for err in result.errors]
if result.errors
else None
)
response_data = {"data": result.data}
if error_data:
response_data["errors"] = error_data
status_code = (
status.HTTP_400_BAD_REQUEST if result.errors else status.HTTP_200_OK
)
return JSONResponse(
response_data, status_code=status_code, background=background
)
I hope this will help others.
Based on the great answer from #Vitaly Radchik, I created more universal and compressed code by redefining the existing handle_graphql after format_graphql_error is defined.
import json, typing, inspect
from starlette import status
from starlette.background import BackgroundTasks
from starlette.requests import Request
from starlette.responses import JSONResponse, PlainTextResponse, Response
from graphql.error.graphql_error import format_error as format_graphql_error
# Get source of `handle_graphql` function
code = inspect.getsource(GraphQLApp.handle_graphql).lstrip()
class CustomGraphQLApp(GraphQLApp):
# Redefine handle_graphql function
exec(code)

Tartiflette + FastApi auth

I am building a tartiflette app with FastApi using tartiflette-asgi and I can't find a way of making regular FastApi authentication or dependency injection work.
The problem lies in how the tartiflette app is built and mounted. When doing
app = FastApi()
gql_app = TartifletteApp(..)
app.mount("/graphql", gql_app)
I have no way of specifying dependencies to execute my headers validation. I've tried using FastApi include_router but it simply doesn't work with TartifletteApp. I have also tried a small hack like
gql_app = TartifletteApp(..)
app.include_router(
gql_app.router,
prefix="/graphql",
# dependencies=[Depends(get_current_user)], # here I would add a token and get a user
)
I get the error
File "/usr/local/lib/python3.6/site-packages/uvicorn/protocols/http/h11_impl.py", line 389, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/usr/local/lib/python3.6/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/fastapi/applications.py", line 181, in __call__
await super().__call__(scope, receive, send) # pragma: no cover
File "/usr/local/lib/python3.6/site-packages/starlette/applications.py", line 111, in __call__
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/starlette/middleware/errors.py", line 181, in __call__
raise exc from None
File "/usr/local/lib/python3.6/site-packages/starlette/middleware/errors.py", line 159, in __call__
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.6/site-packages/starlette/exceptions.py", line 82, in __call__
raise exc from None
File "/usr/local/lib/python3.6/site-packages/starlette/exceptions.py", line 71, in __call__
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.6/site-packages/starlette/routing.py", line 566, in __call__
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/starlette/routing.py", line 227, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/tartiflette_asgi/_endpoints.py", line 84, in dispatch
graphiql = get_graphql_config(request).graphiql
File "/usr/local/lib/python3.6/site-packages/tartiflette_asgi/_middleware.py", line 18, in get_graphql_config
config = conn["graphql"]
File "/usr/local/lib/python3.6/site-packages/starlette/requests.py", line 68, in __getitem__
return self.scope[key]
KeyError: 'graphql'
I could implement the headers validation as a graphql middleware but I was hoping I could do it at theFastApi level so it applies to every endpoint.
Any suggestions on how to solve this?
Create a basic auth first, then add it to Dependencies instead of getting the current user this will add a Basic authentication to your endpoint
from fastapi.security import HTTPBasic, HTTPBasicCredentials
security = HTTPBasic()
app.include_router(
gql_app.router,
prefix="/graphql",
dependencies=[Depends(security)],
)
I have managed to solve this without tartiflette-asgi. The solution is posted here
It looks like:
import os
import json
import typing
from starlette.background import BackgroundTasks
from starlette.datastructures import QueryParams
from starlette.requests import Request
from starlette.responses import HTMLResponse, JSONResponse, PlainTextResponse, Response
from tartiflette import Engine
class GraphQLApp:
def __init__(self, app, modules, schema_path=None, error_coercer=None):
self.engine = Engine(
sdl=schema_path or os.path.join(os.path.dirname(__file__), "schema"),
modules=modules,
error_coercer=error_coercer,
)
app.on_event("startup")(self._cook)
async def _cook(self):
await self.engine.cook()
def _build_context(self, **kwargs):
return kwargs or {} # add custom logic when needed here
async def _get_response(self, request: Request, data: QueryParams, context: dict) -> Response:
try:
query = data["query"]
except KeyError:
return PlainTextResponse("No GraphQL query found in the request", 400)
def _format_error(error: typing.Any) -> dict:
import ast
try:
return ast.literal_eval(str(error))
except ValueError:
return {"message": "Internal Server Error"}
background = BackgroundTasks()
context = {"req": request, "background": background, **self._build_context(**context)}
result: dict = await self.engine.execute(
query,
context=context,
variables=data.get("variables"),
operation_name=data.get("operationName"),
)
content = {"data": result["data"]}
has_errors = "errors" in result
if has_errors:
content["errors"] = [_format_error(error) for error in result["errors"]]
status = 400 if has_errors else 200
return JSONResponse(content=content, status_code=status, background=background)
async def process_request(self, request: Request, context: dict = None) -> Response:
content_type = request.headers.get("Content-Type", "")
if "application/json" in content_type:
try:
data = await request.json()
except json.JSONDecodeError:
return JSONResponse({"error": "Invalid JSON."}, 400)
elif "application/graphql" in content_type:
body = await request.body()
data = {"query": body.decode()}
elif "query" in request.query_params:
data = request.query_params
else:
return PlainTextResponse("Unsupported Media Type", 415)
return await self._get_response(request, data=data, context=context or {})
So I can just do
app = FastApi()
gql_app = GraphQLApp(app)
#app.post("/graphql")
async def graphql_ninja(request: Request):
return await gql_app.process_request(request)

No handlers could be found for logger "django_facebook.models"

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

Resources