Re: Downloading html as pdf using popen, headless chrome option

2022-02-01 Thread Jisson Varghese
Check whether FileResponse instead of StreamingHttpResponse helps to solve
the issue ,
https://docs.djangoproject.com/en/4.0/ref/request-response/#fileresponse-objects

On Tue, Feb 1, 2022 at 11:26 PM Aadil Rashid 
wrote:

> I am trying to generating pdf from webpages, using popen , but when i call
> this
> view it generates UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd3
> in position 10: invalid continuation byte
>
> This is my view
> from projName.settings import BASE_DIR
> from subprocess import Popen, PIPE, STDOUT
> from wsgiref.util import FileWrapper
> from django.http import StreamingHttpResponse
>
> class DownloadAsPDF(View):
> def post(self, request, *args, **kwargs):
> base = str(BASE_DIR)
> file_name = str( base + '/testreport.pdf')
> post_url = request.POST.get("page_url")
> url = str('http://' + request.get_host() + post_url)
> chrome_args = ['/path/google-chrome', '--headless',
> '--virtual-time-buget=2',
> '--print-to-pdf=/path/testreport.pdf', url]
> external_process = Popen(chrome_args, stdout=PIPE, stderr=STDOUT)
> external_process.wait()
> return_file = FileWrapper(open('{}'.format(file_name), 'r'))
> download_file_name = 'report'
> response = StreamingHttpResponse(return_file,
> content_type='application/force-download')
> response['Content-Disposition'] = f'attachment; filename=
> {download_file_name}.pdf'
> return response
>
>
> Can please anybody, tell me why is it generating this error and what is
> the possible solution
> this problem, Thanks you very much
>
> --
> 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/9a0b68e5-a587-4ac4-a018-a8fcc18f1cf4n%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/9a0b68e5-a587-4ac4-a018-a8fcc18f1cf4n%40googlegroups.com?utm_medium=email_source=footer>
> .
>


-- 
*Jisson Varghese*

-- 
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/CAADa5QfL1dmbPFWChRnF8OxowsBaOCAOo2Xq%2Bu-EshjA4LpydA%40mail.gmail.com.


Make migration issue for a unique True filed.

2018-09-26 Thread jisson varghese

I have model MyModel in app app1

class MyModel(models.Model):
 ...
 name = models.CharField(max_length=10, unique=True)


I have made the following change,

class MyModel(models.Model):
 ...
 name = models.CharField(max_length=10, unique=True, null=False)


python manage.py makemigrations  - create migration in file different app, 
and no there is no changes in that model.
When I tried manage.py makemigrations  app1 - No changes detected in app 
'app1'




-- 
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/27bb2c1b-9a3c-4c21-8fc9-cfb1bc7ff0c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: new project directory not defined when starting :

2012-02-21 Thread Jisson Varghese
Hi,
the 
linkmay
help you.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



ipaddress

2012-01-27 Thread Jisson Varghese
Hi all,

First am sorry ,its a python specific question not django based.
 I am developing a mobile application, using  python in server side. I want
to get user's ipaddress(Now user's request not sending ipaddress as a
parameter to my server). I am using cherrypy server , Now I take IPaddress
using following code,
   ipaddress = cherrypy.request.remote.ip
  I have a doubt whether this generate an ipaddress in the form
xx.0.0.0/32
( a private range ).?
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Issues with "startproject"

2012-01-03 Thread Jisson Varghese
Script name may differ in distribution packages

If you installed Django using a Linux distribution's package manager (e.g.
apt-get or yum) django-admin.py may have been renamed to django-admin. You
may continue through this documentation by omitting .py from each command.

Refer: https://docs.djangoproject.com/en/1.3/intro/tutorial01/
just try django-admin .

On Wed, Jan 4, 2012 at 1:00 PM, Jirka Vejrazka wrote:

> > I was able to get the django-admin.py file to be located and I no
> > longer had an error with startproject not executing but there was a
> > random issue with the name of my file. At this point I have no idea
> > what the problem is.
> >
> > http://madtrak.com/error.png
>
> Hi there,
>
>  you are missing the django-admin.py filename on your path. It ends
> with "...\django\bin" which is a directory name, not a file name.
>
>  HTH
>
>Jirka
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Unable to display static content.

2011-12-31 Thread Jisson Varghese
use {{STATIC_URL}} in place of {{MEDIA_URL}} and keep STATIC_ROOT =' ' in
settings page.

refer : https://docs.djangoproject.com/en/dev/howto/static-files/

On Sat, Dec 31, 2011 at 7:42 AM, Chirdeep  wrote:

> Hi All,
>
> I am just learning Python and Django. I am able to see the webpage but
> css and images are not picked up.
>
> Configuration as below:
>
> Linux Ubuntu 11.04
> Python 2.7.2
> Django 1.3.1
>
> I have setup Django using VirtualEnv. I am using PyCharm and my Django
> project is pointing to the VirtualEnv Django installation.
>
> In firebug, I am getting 404 for css and images.
>
> Project Structure.
>
> ProjectRoot
> -media
>   -images
>   -stylesheets
> -templates
> -webapp
>
> urls.py
>
> --
> from django.conf.urls.defaults import patterns, include, url
> import settings
> from talenthunt.web import views
>
> urlpatterns = patterns('',
>url(r'^search-form/$', views.search_form),
>url(r'^search/$', views.search),
> )
>
> if settings.DEBUG:
>urlpatterns += patterns('',
>(r'^media/(?P.*)$', 'django.views.static.serve', {
>'document_root': settings.MEDIA_ROOT}))
>
>
> settings.py
>
> ---
> def rel(*x):
>return os.path.join(os.path.abspath(os.path.dirname(__file__)),
> *x )
>
> MEDIA_ROOT = rel('media')
> MEDIA_URL = '/media/'
>
> STATIC_ROOT = rel('static')
> STATIC_URL = '/static/'
>
> ADMIN_MEDIA_PREFIX = '/media/admin/'
>
> Only pasting relevant code from settings.py
>
> Base.html
>
> --
> 
>
>Organic Web Design
> rel="stylesheet" type="text/css" />
> 
>
> Any help will be much appreciated.
>
> Thanks
> Chirdeep
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Creating websites like Amazon/Ebay using Django

2011-12-17 Thread Jisson Varghese
well Django is suitable for web application development.
Django uses Python for serverside
Mysql is a good choice as Database.In a web app database stores user
credentials,sessions,and items,its price(in your case).
I suggest SQlalchemy (ORM).
first try with djnago orm (models),then shift to sqlalchemy.
learn basics of Html,javascript,ajax,jquery,I recommand
www.w3schools.com(for a beginner).

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: static file problem with modwsgi+ apache2 with django1.3

2011-12-10 Thread Jisson Varghese
@ Ramiro Morales Thank you for your response, *edit the configuration file
as you suggested ,But still am facing the problem.*
I have one doubt about the configuration
I used collectstatic command for static files,
STATIC_ROOT =
'/home/jisson/Desktop/testcloud.aws/DjangoApis/teststaticfiles/'
 STATIC_URL = '/static/'

Whether I add static or teststaticfiles in the last of following line now
am added  'static'

 Alias /static/ /home/jisson/Desktop/testcloud.aws/DjangoApis/static/


teststaticfiles - is the directory in my project where collect static
command collects and save all of my static contents.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Template Renderer safe if used with URL parameters?

2011-12-09 Thread Jisson Varghese
@Mathew ,am sorry i don't know is it safe or not,Its the one of the
question I wished to ask to some one.I think most of the applications use
ajax get methods ,since its faster.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: custom table for django authentication possible

2011-10-19 Thread Jisson Varghese
I want to do this since,The project I am handling(my first web project) is a
mobile version of a project ,there is already a user table in our
serverside.So avoid redundancy ,am not able to create a new table for users.

On Thu, Oct 13, 2011 at 8:11 PM, Benedict Verheyen <
benedict.verhe...@gmail.com> wrote:

> On 13/10/2011 13:15, Jiss wrote:
> > I am new to django. Can I use my own table (say) 'User' instead of
> > 'auth_user' table (keeeping all other tables for django
> > authentication ) ?.
> >
>
> Why would you want to do that?
> Keep everything standard and put the fields you want in a UserProfile
> of your own where you store the extra information.
> See the django doc:
>
> https://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users
>
> Cheers,
> Benedict
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.