wkhtmltopdf on Amazon ElasticBeanstalk - ModuleNotFoundError: No module named 'main'

2020-02-21 Thread Abdulrasheed Ibrahim
Hello everyone, I need a hand a here.

I have an app that uses wkhtmltopdf for generating pdf files, it works
perfectly on my development environment.

I now deployed the project on amazon eb and it doesn't work, below is the
stacktrace:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
  File "/usr/lib64/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
  File
"/opt/python/run/venv/local/lib/python3.6/site-packages/django/utils/autoreload.py",
line 53, in wrapper
fn(*args, **kwargs)
  File
"/opt/python/run/venv/local/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
line 109, in inner_run
autoreload.raise_last_exception()
  File
"/opt/python/run/venv/local/lib/python3.6/site-packages/django/utils/autoreload.py",
line 76, in raise_last_exception
raise _exception[1]
  File
"/opt/python/run/venv/local/lib/python3.6/site-packages/django/core/management/__init__.py",
line 357, in execute
autoreload.check_errors(django.setup)()
  File
"/opt/python/run/venv/local/lib/python3.6/site-packages/django/utils/autoreload.py",
line 53, in wrapper
fn(*args, **kwargs)
  File
"/opt/python/run/venv/local/lib/python3.6/site-packages/django/__init__.py",
line 24, in setup
apps.populate(settings.INSTALLED_APPS)
  File
"/opt/python/run/venv/local/lib/python3.6/site-packages/django/apps/registry.py",
line 91, in populate
app_config = AppConfig.create(entry)
  File
"/opt/python/run/venv/local/lib/python3.6/site-packages/django/apps/config.py",
line 90, in create
module = import_module(entry)
  File "/opt/python/run/venv/lib64/python3.6/importlib/__init__.py", line
126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 994, in _gcd_import
  File "", line 971, in _find_and_load
  File "", line 955, in _find_and_load_unlocked
  File "", line 665, in _load_unlocked
  File "", line 678, in exec_module
  File "", line 219, in
_call_with_frames_removed
  File
"/opt/python/run/venv/local/lib/python3.6/dist-packages/wkhtmltopdf/__init__.py",
line 1, in 

*from main import WKhtmlToPdf, wkhtmltopdfModuleNotFoundError: No
module named 'main'*

*Any help *would be appreciated.
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPXBATR4US-pFWKUaW5x38gG7Fu2smwaEQkfCWJm%2BFDR%3Dh%2BT8Q%40mail.gmail.com.


Re: Django's str(queryset.query) returns invalid SQL if I compare datetimes

2019-08-23 Thread Abdulrasheed Ibrahim
What  is your model, is 'date' a DateField or a CharField?

On Thu, Aug 22, 2019, 12:47 PM wd  QuerySet.query is not a plain string, it's an Query object, you can check
> the source code
>
> def __str__(self):
>> """
>> Return the query as a string of SQL with the parameter values
>> substituted in (use sql_with_params() to see the unsubstituted string).
>>
>> Parameter values won't necessarily be quoted correctly, since that is
>> done by the database interface at execution time.
>> """
>> sql, params = self.sql_with_params()
>> return sql % params
>>
>>
> It will not quote the params. Here is a way to get the raw sql,
> https://code.djangoproject.com/ticket/17741#comment:4 , or if you can
> use django-extensions ,set  SHELL_PLUS_PRINT_SQL = True  to print sql
> automatically.
>
>
> On Tue, Aug 20, 2019 at 11:44 PM Jo  wrote:
>
>> I have a Django queryset that I prepare with
>>
>> queryset.filter(date__gte=datetime(2011,1,1))
>>
>>
>> If I then call `str(queryset.query)` I see this in the string:
>>
>> ... WHERE "App_table"."date" >= 2011-1-1
>>
>> However, this is invalid SQL code as if I run this in Postgresql I get
>> this error:
>>
>> ... WHERE "App_table"."date" >= 2011-1-1
>> ERROR:  operator does not exist: date >= integer
>> HINT:  No operator matches the given name and argument type(s). You
>> might need to add explicit type casts.
>>
>>
>> Why is this happening and how can I ask Django to output proper SQL code
>> that I can work on?
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/3f7a7f2d-2e3d-4167-8b77-2b1c7da5446d%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABexzmiKds1bK5Kdy5bhxwgJbovfvdbCCMtNLJMtPcW7XSGJ_w%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPXBATRGd2niOc1TMj%3D2Ar%3D6mHCCgBX0yAiM5yobWeAYU8_LNA%40mail.gmail.com.


Re: reagrding "{% csrf_token %}"issue on my web site login module

2019-05-28 Thread Abdulrasheed Ibrahim
For security reasons, It's not recommended to use csrf_exempt, use it only
where security doesn't matter

On Tue, May 28, 2019, 1:13 PM Jeyakanth T  Hi,
> add one more line in your view.py header
>
> from django.views.decorators.csrf import csrf_exempt
>
>
> then add decorator  before your function
>
> @csrf_exempt
>
> With Regards,
>
> Jeyakanth Thangam,
>
>  +91 89739 - 70708, +91 79046 - 48182
>
> jeyakanth0...@gmail.com 
>
>
> On Tue, May 28, 2019 at 5:26 PM isorae dennis 
> wrote:
>
>> Did you indent accurately
>>
>> On Tue, May 28, 2019, 12:32 The Aryas  wrote:
>>
>>> hello guys, i was working on a clone project and got stuck on a problem.
>>> the {% csrf_token %} that i have applied is not verified ...and the error
>>> login module is following>>
>>>
>>>
>>> 
>>> Forbidden (403)
>>>
>>> CSRF verification failed. Request aborted.
>>> Help
>>>
>>> Reason given for failure:
>>>
>>> CSRF token missing or incorrect.
>>>
>>>
>>> In general, this can occur when there is a genuine Cross Site Request
>>> Forgery, or when Django's CSRF mechanism
>>>  has not been used
>>> correctly. For POST forms, you need to ensure:
>>>
>>>- Your browser is accepting cookies.
>>>- The view function passes a request to the template's render
>>>
>>> 
>>> method.
>>>- In the template, there is a {% csrf_token %} template tag inside
>>>each POST form that targets an internal URL.
>>>- If you are not using CsrfViewMiddleware, then you must use
>>>csrf_protect on any views that use the csrf_token template tag, as
>>>well as those that accept the POST data.
>>>- The form has a valid CSRF token. After logging in in another
>>>browser tab or hitting the back button after a login, you may need to
>>>reload the page with the form, because the token is rotated after a 
>>> login.
>>>
>>> You're seeing the help section of this page because you have DEBUG =
>>> True in your Django settings file. Change that to False, and only the
>>> initial error message will be displayed.
>>> You can customize this page using the CSRF_FAILURE_VIEW setting.
>>>
>>>
>>> 
>>>
>>> I have applied all the requirements but still that occurs. here is my
>>> code>>
>>>
>>> 
>>>
>>> {% extends 'blog/base.html' %}
>>> {% block content %}
>>> 
>>>   Please login!
>>>   (must be suoer user , please check with site admin)
>>> 
>>> {% if forms.errors %}
>>>   Your user name and password did not match please try again!
>>> {% endif %}
>>>
>>> 
>>> {% csrf_token %}
>>> {{ form.as_p }}
>>>   
>>>   
>>> 
>>> {% endblock %}
>>>
>>>
>>> ===
>>> 
>>>
>>>
>>> from django.contrib import admin
>>> from django.http import HttpResponse
>>> from django.shortcuts import get_object_or_404, render
>>> from django.urls import path
>>> from django.conf.urls import include
>>> from django.contrib.auth import views
>>> urlpatterns = [
>>> path('admin/', admin.site.urls),
>>> path('',include('blog.urls')),
>>> path('accounts/login/',views.LoginView.as_view(), name='login'),
>>> path('accounts/logout/',views.LogoutView.as_view(),
>>> name='logout',kwargs={'next_page':'/'})
>>> ]
>>>
>>>
>>> ===
>>> 
>>> *from django.shortcuts import render,get_object_or_404,redirect*
>>> *from django.utils import timezone*
>>> *from blog.models import Post,Comment*
>>> *from blog.forms import PostForm,CommentForm*
>>> *from django.urls import reverse_lazy*
>>> *from django.contrib.auth.decorators import login_required*
>>> *from django.contrib.auth.mixins import LoginRequiredMixin*
>>> *from django.views.generic import (TemplateView,ListView,*
>>> *DetailView,CreateView,*
>>> *UpdateView,DeleteView)*
>>> *# Create your views here.*
>>>
>>> *class AboutView(TemplateView):*
>>> *template_name='about.html'*
>>>
>>> *class PostListView(ListView):*
>>> *model=Post*
>>>
>>> *def get_queryset(self):*
>>> *return
>>> Post.objects.filter(published_date__lte=timezone.now()).order_by('-published_date')*
>>>
>>>
>>> *class PostDetailView(DetailView):*
>>> *model=Post*
>>>
>>> *class CreatePostView(LoginRequiredMixin,CreateView):*
>>> *login_url='/login'*
>>> *redirect_field_name='blog/post_detail.html'*
>>>
>>> *form_class=PostForm*
>>>
>>> *model=Post*
>>>
>>>
>>> *class PostUpdateView(LoginRequiredMixin,UpdateView):*
>>> *login_url='/login'*
>>> *

Re: Hello From Nigeria

2019-03-11 Thread Abdulrasheed Ibrahim
Off course, I'll love to join.

On Mon, Mar 11, 2019 at 2:54 PM Joshua Kayode 
wrote:

> Hello dear try this: *https://chat.whatsapp.com/Fq7rxuwkE3V1ebmGGjpaAI
> <https://chat.whatsapp.com/Fq7rxuwkE3V1ebmGGjpaAI>*
>
> On Mon, Mar 11, 2019, 14:43 Cathbert Mutaurwa 
>> Im receiving a message saying my invite is invalid.
>>
>> On Mon, 11 Mar 2019, 15:30 Joshua Kayode, 
>> wrote:
>>
>>> Here is the link *https://chat.whatsapp.com/Fq7rxuwkE3V1ebmGGjpaAI*
>>>
>>> On Mon, Mar 11, 2019, 14:20 Cathbert Mutaurwa >> wrote:
>>>
>>>> I am in south africa, is it possible if i wanna join?
>>>>
>>>> On Mon, 11 Mar 2019, 15:15 Joshua Kayode, 
>>>> wrote:
>>>>
>>>>> Greetings, if you are a django developer in Nigeria, would you
>>>>> consider joining a WhatsApp group?
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Django users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to django-users+unsubscr...@googlegroups.com.
>>>>> To post to this group, send email to django-users@googlegroups.com.
>>>>> Visit this group at https://groups.google.com/group/django-users.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/CAEL9fCFn_XXW26_wXAz0K%3DaHTA31mhWMhhCQcxvpMSn1ZMSuEg%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/django-users/CAEL9fCFn_XXW26_wXAz0K%3DaHTA31mhWMhhCQcxvpMSn1ZMSuEg%40mail.gmail.com?utm_medium=email_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to django-users+unsubscr...@googlegroups.com.
>>>> To post to this group, send email to django-users@googlegroups.com.
>>>> Visit this group at https://groups.google.com/group/django-users.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/CA%2BjnFn8qUCeJRZyTvXknPCEhTrreSGDcYMwCXDaNzktt9b%2B4QQ%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CA%2BjnFn8qUCeJRZyTvXknPCEhTrreSGDcYMwCXDaNzktt9b%2B4QQ%40mail.gmail.com?utm_medium=email_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAEL9fCGAFZ7nVwprFniryyYsCf5yesOk%2BaaC8aq20Uo3sXfVgA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAEL9fCGAFZ7nVwprFniryyYsCf5yesOk%2BaaC8aq20Uo3sXfVgA%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2BjnFn-yyJKQAqYWG2vcFTfTkG%3D8T69qXSg2-vB%2BDjP3kpLFBQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CA%2BjnFn-yyJKQAqYWG2vcFTfTkG%3D8T69qXSg2-vB%2BDjP3kpLFBQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegro

Re: simple boy start learn python

2019-01-05 Thread Abdulrasheed Ibrahim
Djangogirls tutorial will be very helpful.

https://docs.djangoproject.com/en/2.1/intro/tutorial01/

On Sat, 5 Jan 2019, 9:51 pm omar ahmed,  wrote:

> Django documentation is very good
>
> بتاريخ ٢٠١٩/٠١/٠٥ ١٠:٤٦ م، كتب :
>
>> I know that you are exp in django, so I need you tell me the best way to
>> learn django is what ?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/ee9279fe-979a-4db4-a9b3-753ea7c3cc2c%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAOy9vcOdgLjMa52%2BOg4%2BPVeaqnM3aQWG63Y1ouLoOwdQda_NZA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPXBATT7VeXy0RC21x5Zyks2_7E0x5EaDrDAM-GNyn4-HrovPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.