Re: Django Sass verwenden

2017-05-02 Thread Andréas Kühne
Hi,

Sorry my german is very rusty - but it looks like you need something to
compile your sass files to css. Checkout this project for an example:
https://github.com/andreyfedoseev/django-static-precompiler

I use PyCharm as my IDE and it includes automatic conversion from scss
files to css - so I haven't tried it.

Regards,

Andréas

2017-05-01 22:03 GMT+02:00 Jonas Niedermair :

> Ich habe vor einiger Zeit begonnen Django zu lernen. Bisher habe ich immer
> direkt CSS verwendet. Ich möchte jedoch Sass verwenden, weiß jedoch nicht
> wo ich die Sass Dateien in meinem Django Projekt speichern soll und wie ich
> die Sass Datein am besten in CSS konvertieren kann.
>
> Ich habe bereits versucht mit Pipeline die Sass Dateien in CSS zu
> konvertieren. Das hat auch funktioniert, aber wie schaffe ich es dass die
> CSS Dateien nicht nur im static Ordner des Projektordners sondern im static
> Ordner der jeweiligen App gespeichert werden ?
>
> Ich hoffe ihr könnt mir weiterhelfen
>
> --
> 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/933a2ef5-2a30-493f-be56-12e77a90a073%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/CAK4qSCcJi5Y_a-KozHY0crd5Dffqf2ea1spmMVA_WRFAirNmnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Generating HDF5 and downloading

2017-05-02 Thread Michal Petrucha
On Fri, Apr 28, 2017 at 03:38:36PM -0700, avill...@ucsc.edu wrote:
> Hi everybody, 
> 
> I've successfully gotten a web app that takes user data, uses that to make 
> a query, and the outputs a CSV file. However, what I'd really like is to 
> output an HDF5 file. I googled around and there doesn't seem to be any 
> documentation on outputting an HD5F file from a Django web app. I tried 
> adapting the Django example of outputting a PDF (
> https://docs.djangoproject.com/en/1.10/howto/outputting-pdf/) like this,
> 
> 
> I'm making a website using the Django framework. I've successfully gotten a 
> web app that takes user data, uses that to make a query, and the outputs a 
> CSV file. However, what I'd really like is to output an HDF5 file. I 
> googled around and there doesn't seem to be any documentation on outputting 
> an HD5F file from a Django web app. I tried adapting the Django example of 
> outputting a PDF (
> https://docs.djangoproject.com/en/1.10/howto/outputting-pdf/) like this,
> 
> response = HttpResponse(content_type='application/hdf5')
> response['Content-Disposition'] = 'attachment; filename="test.hdf5"'
> 
> h = h5py.File(response)
> h.create_dataset('Name', data=test[0].name)
> 
> 
> but I get the following error, 
> 
> 'HttpResponse' object has no attribute 'encode'
> 
> 
> So I guess I'm misunderstanding how to use content_type in Django's 
> HttpResponse. Does anybody have any experience with outputting HDF5 files 
> form a Django web app or could help clarify how I might adapt the 
> HttpResponse to work with HDF5?

Hi,

I've never personally used h5py, but at least from the docs [1] it
looks like it only supports writing output to real files in the local
filesystem, not into any file-like object. From a cursory look, the
documentation seems to imply that all file operations are performed by
low-level C code that doesn't know a thing about Python, which makes
it hard to support file-like Python objects.

According to the docs, the “core” file driver with backing_store=False
might do the trick, but I don't see how you could then read the byte
stream of the in-memory file afterwards. Barring that, you'll need to
create a temporary file (for example with the tempfile module [2]),
write the HDF5 file there, read it into the response, and finally
delete the temporary file.

Good luck,

Michal

[1]: http://docs.h5py.org/en/latest/high/file.html#File
[2]: https://docs.python.org/3/library/tempfile.html

-- 
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/20170502082822.GB23772%40konk.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: Digital signature


django-select2-forms

2017-05-02 Thread shahab emami
hello

I want to use django-select2-forms in my project . this package is here:
https://pypi.python.org/pypi/django-select2-forms/2.0.1

I followed the exact instructions but It does not install
here is things I did:

1:   
pip install django-select2-forms


  I can see select2 has been installed in my site package
2:   I added this line to my_installed_packages in settings.py:
 
   'select2',


3:  I added this line to main urls.py:
 
   url(r'^select2/', include('select2.urls')),



after that i put this models in my models.py they are from it's example:



class Author(models.Model):
name = models.CharField(max_length=100)

def __str__(self):
return self.name

class Entry(models.Model):
author = select2.fields.ForeignKey(Author,
overlay="Choose an author...",
on_delete=models.CASCADE)

but when i run :
python manage.py makemigrations

I get this error:
author = select2.fields.ForeignKey(Author,
NameError: name 'select2' is not defined

I searched for this but i could not find anything.
would you help me please?
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 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/b1d0b422-01e6-43e3-88af-1600af503c06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Link to download

2017-05-02 Thread Sixtine Vernhes
Hi ! 

I try to create a link on Django who download a static csv file, but I have 
no idea how to do. 
In my settings.py :

STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static/"),
)

and my file is in this directory 

Would anyone have an idea ? 


-- 
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/c505a804-3cc6-4584-a47a-bffadee6fb5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Configurar Supervisor + Gunicorn + Nginx

2017-05-02 Thread Ariel Gavegno
Buenas, necesito saber como configurar Supervisor en un servidor Ubuntu, de 
un proyecto Django 1.11.
Un ejemplo sería de mucha ayuda.

-- 
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/811ff4e4-5a44-47e4-bc39-e9d7d23bfdc3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Configurar Supervisor + Gunicorn + Nginx

2017-05-02 Thread Simon McConnell


https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04




On Tuesday, 2 May 2017 20:34:31 UTC+10, Ariel Gavegno wrote:
>
> Buenas, necesito saber como configurar Supervisor en un servidor Ubuntu, 
> de un proyecto Django 1.11.
> Un ejemplo sería de mucha ayuda.
>
>

-- 
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/e40ae57f-0069-4bd1-9c6c-7ed0b22dd846%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Link to download

2017-05-02 Thread Antonis Christofides
Is this in production or development? What is the url that doesn't work? What
happens when you try the url?

Regards,

A.

Antonis Christofides
http://djangodeployment.com

On 2017-05-02 11:28, Sixtine Vernhes wrote:
> Hi !
>
> I try to create a link on Django who download a static csv file, but I have no
> idea how to do.
> In my settings.py :
>
> STATIC_URL = '/static/'
> STATICFILES_DIRS = (
> os.path.join(BASE_DIR, "static/"),
> )
>
> and my file is in this directory
>
> Would anyone have an idea ?
>
> -- 
> 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/c505a804-3cc6-4584-a47a-bffadee6fb5e%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/59ec32d5-ba35-7421-0cca-bfc327ecc63e%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.


Re: Link to download

2017-05-02 Thread Sixtine Vernhes
This is in development. I try to send url of my file in views.py : 
   
 return render(request, "export.html", {'out': urlOut})

and in my template I have the link : 

Lien du  fichier 

but when I open it I have this link : 

http://127.0.0.1:8000/home/myuser/Data/01/export.txt 

and I want to have this to download the file : 
/home/myuser/Data/01/export.txt 

Have you any ideas? 

(sorry i'm newbie in django ^^)

Le mardi 2 mai 2017 14:04:05 UTC+2, Antonis Christofides a écrit :
>
> Is this in production or development? What is the url that doesn't work? 
> What happens when you try the url?
>
> Regards,
>
> A.
>
> Antonis Christofideshttp://djangodeployment.com
>
> On 2017-05-02 11:28, Sixtine Vernhes wrote:
>
> Hi ! 
>
> I try to create a link on Django who download a static csv file, but I 
> have no idea how to do. 
> In my settings.py :
>
> STATIC_URL = '/static/'
> STATICFILES_DIRS = (
> os.path.join(BASE_DIR, "static/"),
> )
>
> and my file is in this directory 
>
> Would anyone have an idea ? 
>
>  -- 
> 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...@googlegroups.com .
> To post to this group, send email to django...@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/c505a804-3cc6-4584-a47a-bffadee6fb5e%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/e136ff80-bd25-4a06-ae08-9401e28c3c23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django-select2-forms

2017-05-02 Thread Dartos
Hi,

Do you have "import select2" in models.py?

Dartos

On Tuesday, May 2, 2017 at 6:16:47 AM UTC-4, shahab emami wrote:
>
> hello
>
> I want to use django-select2-forms in my project . this package is here:
> https://pypi.python.org/pypi/django-select2-forms/2.0.1
>
> I followed the exact instructions but It does not install
> here is things I did:
>
> 1:   
> pip install django-select2-forms
>
>
>   I can see select2 has been installed in my site package
> 2:   I added this line to my_installed_packages in settings.py:
>  
>'select2',
>
>
> 3:  I added this line to main urls.py:
>  
>url(r'^select2/', include('select2.urls')),
>
>
>
> after that i put this models in my models.py they are from it's example:
>
>
>
> class Author(models.Model):
> name = models.CharField(max_length=100)
>
> def __str__(self):
> return self.name
>
> class Entry(models.Model):
> author = select2.fields.ForeignKey(Author,
> overlay="Choose an author...",
> on_delete=models.CASCADE)
>
> but when i run :
> python manage.py makemigrations
>
> I get this error:
> author = select2.fields.ForeignKey(Author,
> NameError: name 'select2' is not defined
>
> I searched for this but i could not find anything.
> would you help me please?
> 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 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/80363bd5-375a-4b40-8583-a01229abe392%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Where is django-admin?

2017-05-02 Thread Pelle Pälsänger


Den torsdag 27 april 2017 kl. 15:22:13 UTC+2 skrev Pelle Pälsänger:
>
> Hi!
>
> I try to learn how to create web apps with django on windows10. 
> I have downloaded django1.11 ($git clone 
> https://github.com/django/django.git) and installed it ($py -m pip 
> install Django==1.11).
> I follow 
> https://pythonprogramming.net/django-web-development-with-python-intro/
>
> Then I try to start a project with django-admin startproject mySite, but 
> django-admin is not recognized as a command. I search for django-admin but 
> I cannot find it. Tell me why? Where should I find it, to add it to path!?
>
> BR. Pelle
>

-- 
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/23c9c197-71fa-4119-b294-81b6a60a6427%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Where is django-admin?

2017-05-02 Thread Pelle Pälsänger
Hi friends!
It worked when I run $python django-admin.exe startproject mysite, not with 
django-admin.py. This is Windows 10.1. Python 3.6.1. 

BR.
Stig

Den torsdag 27 april 2017 kl. 15:22:13 UTC+2 skrev Pelle Pälsänger:
>
> Hi!
>
> I try to learn how to create web apps with django on windows10. 
> I have downloaded django1.11 ($git clone 
> https://github.com/django/django.git) and installed it ($py -m pip 
> install Django==1.11).
> I follow 
> https://pythonprogramming.net/django-web-development-with-python-intro/
>
> Then I try to start a project with django-admin startproject mySite, but 
> django-admin is not recognized as a command. I search for django-admin but 
> I cannot find it. Tell me why? Where should I find it, to add it to path!?
>
> BR. Pelle
>

-- 
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/7a65bb45-ae38-4e8b-b54e-14075525a142%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Link to download

2017-05-02 Thread m712 - Developer
You cannot get a file outside of your project unless you symlink it inside the 
project. This is also a Very Bad Thing(TM) as it may allow attackers to request 
arbitrary files.
What you should do instead is this:
1) Put Data/01/export.txt to the static/ folder inside your app (with the same 
folder structure if you need it that way)
2) Build the path to your file with /static/ as prefix, i.e. 
http://127.0.0.1/static/Data/01/export.txt

On May 2, 2017 3:44 PM, Sixtine Vernhes  wrote:
>
> This is in development. I try to send url of my file in views.py : 
>    
>  return render(request, "export.html", {'out': urlOut})
>
> and in my template I have the link : 
>
> Lien du  fichier 
>
> but when I open it I have this link : 
>
> http://127.0.0.1:8000/home/myuser/Data/01/export.txt 
>
> and I want to have this to download the file : 
> /home/myuser/Data/01/export.txt 
>
> Have you any ideas? 
>
> (sorry i'm newbie in django ^^)
>
> Le mardi 2 mai 2017 14:04:05 UTC+2, Antonis Christofides a écrit :
>>
>> Is this in production or development? What is the url that doesn't work? 
>> What happens when you try the url?
>>
>> Regards,
>>
>> A.
>>
>> Antonis Christofides
>>
>> http://djangodeployment.com
>>
>> On 2017-05-02 11:28, Sixtine Vernhes wrote:
>>>
>>> Hi ! 
>>>
>>> I try to create a link on Django who download a static csv file, but I have 
>>> no idea how to do. 
>>> In my settings.py :
>>>
>>> STATIC_URL = '/static/'
>>> STATICFILES_DIRS = (
>>>     os.path.join(BASE_DIR, "static/"),
>>> )
>>>
>>> and my file is in this directory 
>>>
>>> Would anyone have an idea ? 
>>>
>>>
>>>
>>> -- 
>>> 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...@googlegroups.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 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/j5ftp2xrd2aps3c4mtn66umn.1493736693783%40email.android.com.
For more options, visit https://groups.google.com/d/optout.


Re: Different models in child and Parent Templates

2017-05-02 Thread jithu s jacob

  
{% include 'blog/navbar.html' %}


  RECENT POSTS
  
  {%block content %}
  {% endblock%}


  


class HomeView(ListView):
template_name='blog/home.html'
model=Blog

class BlogView(DetailView):
template_name='blog/blog.html'
model=Blog


class ContactView(ListView): > i don't need model blog for 
contactview.But I am using it to populate side navbar.If I have other 
similar 
   views.should it done in the same way
template_name='blog/contact.html'
model=Blog



On Monday, May 1, 2017 at 4:50:37 PM UTC+5:30, jithu s jacob wrote:
>
> I am using parent template as base which has a side nav bar. the child 
> template keeps changing with clicking of buttons.
>  
> My child template changes correctly with call to different views through 
> the URLs.
>
> Now I want to add some data from model i the parent template irrespective 
> of the view/model  or URL being called in the child template.
>
> is there any easy was to do this.
>
> for now I am writing additional context variables for parent template for 
> all the child views. But this is not feasible
>

-- 
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/ed482367-15ae-47f8-89ce-f38de7a9261b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Link to download

2017-05-02 Thread Antonis Christofides
> You cannot get a file outside of your project unless you symlink it inside the
> project. This is also a Very Bad Thing(TM) as it may allow attackers to
> request arbitrary files.
You /can/ get a file outside your project. Whether this is a bad thing or not
depends on why and how. I also don't think this file should be placed in the
static directory. The static directory is for files that don't change after the
program is installed. The media directory might be more appropriate.

If what you are doing is to dynamically create a csv file for your user to
download immediately, one possible way of doing that is (untested):

from tempfile import TemporaryFile

csvfile = TemporaryFile()
export_your_data_to_the_file(csvfile)
file_size = csvfile.tell()
csvfile.seek(0)
response = HttpResponse(csvfile.read(), content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename=whateveryoulike.csv'
response['Content-Length'] = str(size)
return response

Regards,

A.

Antonis Christofides
http://djangodeployment.com

On 2017-05-02 17:53, m712 - Developer wrote:
>
> You cannot get a file outside of your project unless you symlink it inside the
> project. This is also a Very Bad Thing(TM) as it may allow attackers to
> request arbitrary files.
> What you should do instead is this:
> 1) Put Data/01/export.txt to the static/ folder inside your app (with the same
> folder structure if you need it that way)
> 2) Build the path to your file with /static/ as prefix, i.e.
> http://127.0.0.1/static/Data/01/export.txt
>
> On May 2, 2017 3:44 PM, Sixtine Vernhes  wrote:
>
> This is in development. I try to send url of my file in views.py :
>   
> |
>  returnrender(request,"export.html",{'out':urlOut})
> |
>
> and in my template I have the link :
>
> |
> Liendu fichier 
> |
>
> but when I open it I have this link :
>
> http://127.0.0.1:8000/home/myuser/Data/01/export.txt
>
> and I want to have this to download the file :
> /home/myuser/Data/01/export.txt
>
> Have you any ideas?
>
> (sorry i'm newbie in django ^^)
>
> Le mardi 2 mai 2017 14:04:05 UTC+2, Antonis Christofides a écrit :
>
> Is this in production or development? What is the url that doesn't
> work? What happens when you try the url?
>
> Regards,
>
> A.
>
> Antonis Christofides
> http://djangodeployment.com
>
> On 2017-05-02 11:28, Sixtine Vernhes wrote:
>> Hi !
>>
>> I try to create a link on Django who download a static csv file, but
>> I have no idea how to do.
>> In my settings.py :
>>
>> STATIC_URL = '/static/'
>> STATICFILES_DIRS = (
>> os.path.join(BASE_DIR, "static/"),
>> )
>>
>> and my file is in this directory
>>
>> Would anyone have an idea ?
>>
>> -- 
>> 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...@googlegroups.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 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/j5ftp2xrd2aps3c4mtn66umn.1493736693783%40email.android.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/d73a67a4-49d9-ec8c-14f4-e3ccf44167d0%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.


Python package to accept payments in Internet

2017-05-02 Thread Victor Porton
I have created a full featured package to accept payments in Internet
(currently supports PayPal).

It has especially great support for recurring payments.

Here it is:

http://freesoft.portonvictor.org/django-debits.xml

I hope we with community work will turn it into an universal payment
gateway for many different payment processors.

Buy the commercial version and support scientific research and a new
principle of the Web I am working on.

I hope you don't take this message as spam. Is it OK to post updates of
 our software to this mailing list in the future?

-- 
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/1493741896.24841.14.camel%40narod.ru.
For more options, visit https://groups.google.com/d/optout.


Re: Different models in child and Parent Templates

2017-05-02 Thread chuck . horowitz
So what would you like the ContactView to populate *into *the nav bar? 
 Without a data model, there is nothing to render.

Remember that {% include 'blog/navbar.html' %} will not access/render that 
"url", it will simply paste in the contents of that file(template) into the 
template before rendering (i.e. expanding tags), so the tags in that file 
will be expanded based on whatever Context dict is passed to the method 
which is rendering it.

But I may not be understanding the problem clearly.

On Tuesday, May 2, 2017 at 11:07:03 AM UTC-4, jithu s jacob wrote:
>
> 
>   
> {% include 'blog/navbar.html' %}
>
> 
>   RECENT POSTS
>   
>   {%block content %}
>   {% endblock%}
> 
> 
>   
> 
>
> class HomeView(ListView):
> template_name='blog/home.html'
> model=Blog
>
> class BlogView(DetailView):
> template_name='blog/blog.html'
> model=Blog
>
>
> class ContactView(ListView): > i don't need model blog for 
> contactview.But I am using it to populate side navbar.If I have other 
> similar 
>views.should it done in the same way
> template_name='blog/contact.html'
> model=Blog
>
>
>
> On Monday, May 1, 2017 at 4:50:37 PM UTC+5:30, jithu s jacob wrote:
>>
>> I am using parent template as base which has a side nav bar. the child 
>> template keeps changing with clicking of buttons.
>>  
>> My child template changes correctly with call to different views through 
>> the URLs.
>>
>> Now I want to add some data from model i the parent template irrespective 
>> of the view/model  or URL being called in the child template.
>>
>> is there any easy was to do this.
>>
>> for now I am writing additional context variables for parent template for 
>> all the child views. But this is not feasible
>>
>

-- 
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/1be4f422-3a3a-4ada-ae6f-cef3aa85c053%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Split an existing app up into multiple apps.

2017-05-02 Thread Derek
There is a post on SO which seems to address this:

http://stackoverflow.com/questions/42059381/django-migrate-change-of-app-name-active-project

Maybe try renaming before you split; but moving models to a new app should 
be the same kind of process as renaming.

On Monday, 1 May 2017 17:15:07 UTC+2, Frederik Creemers wrote:
>
> Hi.
>
> Is there a guide on how to split up an existing Django app into multiple 
> apps?
>
> When I created my project, I foolishly created an app called "common". 
> Generic names like that attract all sorts of functionality, and now I think 
> it'd be a good idea to split it up.
>

-- 
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/9d784904-9d56-444d-96b5-f9baf2966c4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


pass context to overridden templates

2017-05-02 Thread cjdcordeiro
Hi guys,

I'm using django-notification-hq, so my app's urls.py has:

...
   url(r'^inbox/', include(notifications.urls, namespace='notifications')),
...


I've modified those default templates but I am unable to pass context to 
them. 

I found 
this: https://github.com/django-crispy-forms/django-crispy-forms/issues/646

It isn't old so I'm afraid this is yet not possible? Any workarounds?

Cheers,
Cris

-- 
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/3f62f83c-0dd0-4926-b78a-28c0747fd146%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Channels, Nginx, Daphne - Not working?

2017-05-02 Thread Alex Elson
I am using Google Cloud to host my Django project, and I'm trying to run it 
with Nginx. I open two instances of the terminal, one with the command 
"python manage.py runworker" and the other with "daphne 
firstproject.asgi:channel_layer". I am able to connect to my public ip, and 
the page loads the clientside Javascript, but all the 'Channels' parts do 
not seem to work despite all this. What could be wrong? What am I 
forgetting? Thanks for any help. 

Here is my response to these commands, as well as my CHANNELS_LAYER in my 
settings file.

$ daphne firstproject.asgi:channel_
layer
2017-05-02 07:01:04,853 INFO Starting server 
attcp:port=8000:interface=127.0.0.1, channel layer 
firstproject.asgi:channel_layer.
2017-05-02 07:01:04,853 INFO HTTP/2 support enabled
2017-05-02 07:01:04,853 INFO Using busy-loop synchronous mode on 
channel layer
2017-05-02 07:01:04,854 INFO Listening on endpoint 
tcp:port=8000:interface=127.0.0.1
127.0.0.1:47296 - - [02/May/2017:07:01:17] "GET /" 200 5801

$ python manage.py runworker
2017-05-02 07:06:12,589 - INFO - runworker - Using single-threaded worker.
2017-05-02 07:06:12,589 - INFO - runworker - Running worker against channel 
layer default (asgi_redis.core.RedisChannelLayer)
2017-05-02 07:06:12,590 - INFO - worker - Listening on channels 
http.request, websocket.connect, websocket.disconnect, websocket.receive

CHANNEL_LAYERS = {
"default": {
"BACKEND": "asgi_redis.RedisChannelLayer",
"CONFIG": {
"hosts": [("localhost", 6379)],
},
"ROUTING": "firstproject.routing.channel_routing",
},
}

-- 
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/166ef732-aa07-478e-8b7d-dcd03d7924f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: port 80 **** Hit EOF while fetching headers

2017-05-02 Thread zhenwuhe0611

Thanks for your response. 

Our server has 24 Cores and 192G memory, should be big enough to handle 
this kind of load? BTW, one more thing I want to mention is that we are 
using host based docker, possible any config or limitation there?

thanks again.


On Monday, May 1, 2017 at 11:06:39 PM UTC-7, Antonis Christofides wrote:
>
> Hi,
>
> With an average of 150 requests per second, it is likely that your server 
> is overloaded. You need to examine the available memory and CPU usage.
>
> Regards,
>
> A.
>
> Antonis Christofideshttp://djangodeployment.com
>
> On 2017-05-01 22:53, zhenwu...@gmail.com  wrote:
>
>
> Hi, Experts:
>
> We built our system using apache + django and we have lots of clients 
> sending updates to our backend server at around 1min interval. But we do 
> have 9000 around devices. From time to time, we are seeing port 80  
> Hit EOF while fetching headers in apache log or 500 error, could anybody 
> tell me what does this mean and what maybe the possible reason to cause 
> this? or any suggestion what I could do to isolate what cause this issue.
>
> thanks in advance.
>
>
> -- 
> 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...@googlegroups.com .
> To post to this group, send email to django...@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/5072b5af-5f78-4b75-83af-70da26bff125%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/4d62efaf-654b-40ff-a895-efcb1bf2a7e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels, Nginx, Daphne - Not working?

2017-05-02 Thread Andrew Godwin
Aha, it looks like your daphne instance is only listening on localhost:

2017-05-02 07:01:04,853 INFO Starting server
attcp:port=8000:interface=127.0.0.1, channel layer
firstproject.asgi:channel_layer.

Try binding to all interfaces by passing

-b 0.0.0.0

to Daphne when it starts.

Andrew

On Tue, May 2, 2017 at 1:27 PM, Alex Elson  wrote:

> I am using Google Cloud to host my Django project, and I'm trying to run
> it with Nginx. I open two instances of the terminal, one with the command
> "python manage.py runworker" and the other with "daphne
> firstproject.asgi:channel_layer". I am able to connect to my public ip,
> and the page loads the clientside Javascript, but all the 'Channels' parts
> do not seem to work despite all this. What could be wrong? What am I
> forgetting? Thanks for any help.
>
> Here is my response to these commands, as well as my CHANNELS_LAYER in my
> settings file.
>
> $ daphne firstproject.asgi:channel_
> layer
> 2017-05-02 07:01:04,853 INFO Starting server
> attcp:port=8000:interface=127.0.0.1, channel layer
> firstproject.asgi:channel_layer.
> 2017-05-02 07:01:04,853 INFO HTTP/2 support enabled
> 2017-05-02 07:01:04,853 INFO Using busy-loop synchronous mode on
> channel layer
> 2017-05-02 07:01:04,854 INFO Listening on endpoint
> tcp:port=8000:interface=127.0.0.1
> 127.0.0.1:47296 - - [02/May/2017:07:01:17] "GET /" 200 5801
>
> $ python manage.py runworker
> 2017-05-02 07:06:12,589 - INFO - runworker - Using single-threaded worker.
> 2017-05-02 07:06:12,589 - INFO - runworker - Running worker against
> channel layer default (asgi_redis.core.RedisChannelLayer)
> 2017-05-02 07:06:12,590 - INFO - worker - Listening on channels
> http.request, websocket.connect, websocket.disconnect, websocket.receive
>
> CHANNEL_LAYERS = {
> "default": {
> "BACKEND": "asgi_redis.RedisChannelLayer",
> "CONFIG": {
> "hosts": [("localhost", 6379)],
> },
> "ROUTING": "firstproject.routing.channel_routing",
> },
> }
>
> --
> 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/166ef732-aa07-478e-8b7d-dcd03d7924f1%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/CAFwN1uqL7DRYQbT8gcfmJi3kHM%2Baw9UoijiKe5L9uqOfheg%2BGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How can I access obj in admin.py

2017-05-02 Thread Mike Dewhirst

I want to adjust inlines based on a property of the object.

class SubstanceAdmin(admin.ModelAdmin):

class SolidInline(admin.StackedInline):
pass
class LiquidInline(admin.StackedInline):
pass
class GasInline(admin.StackedInline):
pass

inlines = get_inlines

def get_inlines(self):
obj = how_do_I_get_this(?)
if obj.physical_state = None:
return ((SolidInline), (LiquidInline), (GasInline))
elif obj.physical_state = 1:
return ((SolidInline), )
elif obj.physical_state = 2:
return ((LiquidInline), )
elif obj.physical_state = 3:
return ((GasInline), )

Many thanks for a miracle :)

Mike

--
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/a138bd6c-46fb-98c7-ba28-69a5959e5fbc%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: port 80 **** Hit EOF while fetching headers

2017-05-02 Thread Antonis Christofides
Hi,

Your server most probably can handle the load. It depends of course on how
intensive the processing is. The kind of error you are getting (port 80  Hit
EOF while fetching headers) suggests that the problem is not in Django but in
Apache, or maybe you are hitting some operating system limit. However nothing is
certain without more information.

If you haven't already done so, you should configure Apache and syslog to use a
timestamp that is accurate to the microsecond. You can then check to see other
log files such as /var/log/syslog (assuming Linux) to see whether they have more
information than the apache log at the exact time the error occurs.

Given that this is most probably not a Django issue but an Apache issue or an
operating system issue, you may be able to get better help elsewhere, for
example in serverfault.com.

Regards,

A.

Antonis Christofides
http://djangodeployment.com



On 2017-05-03 02:31, zhenwuhe0...@gmail.com wrote:
>
> Thanks for your response. 
>
> Our server has 24 Cores and 192G memory, should be big enough to handle this
> kind of load? BTW, one more thing I want to mention is that we are using host
> based docker, possible any config or limitation there?
>
> thanks again.
>
>
> On Monday, May 1, 2017 at 11:06:39 PM UTC-7, Antonis Christofides wrote:
>
> Hi,
>
> With an average of 150 requests per second, it is likely that your server
> is overloaded. You need to examine the available memory and CPU usage.
>
> Regards,
>
> A.
>
> Antonis Christofides
> http://djangodeployment.com
>
> On 2017-05-01 22:53, zhenwu...@gmail.com  wrote:
>>
>> Hi, Experts:
>>
>> We built our system using apache + django and we have lots of clients
>> sending updates to our backend server at around 1min interval. But we do
>> have 9000 around devices. From time to time, we are seeing port 80 
>> Hit EOF while fetching headers in apache log or 500 error, could anybody
>> tell me what does this mean and what maybe the possible reason to cause
>> this? or any suggestion what I could do to isolate what cause this issue.
>>
>> thanks in advance.
>>
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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/5072b5af-5f78-4b75-83af-70da26bff125%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/4d62efaf-654b-40ff-a895-efcb1bf2a7e8%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/6ba224f7-8134-89e6-241c-21e0d88f8291%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels, Nginx, Daphne - Not working?

2017-05-02 Thread Alex Elson
Andrew, it doesn't seem to have fixed my problem. I type the following 
command, and am able to connect to my public ip, and although my page 
loads, only the frontend does anything. Channels does not work.

$ daphne -b 0.0.0.0 firstproject.asgi:channel_layer
2017-05-03 06:11:51,196 INFO Starting server at 
tcp:port=8000:interface=0.0.0.0, channel layer 
firstproject.asgi:channel_layer.
2017-05-03 06:11:51,197 INFO HTTP/2 support enabled
2017-05-03 06:11:51,197 INFO Using busy-loop synchronous mode on 
channel layer
2017-05-03 06:11:51,197 INFO Listening on endpoint 
tcp:port=8000:interface=0.0.0.0
127.0.0.1:51076 - - [03/May/2017:06:11:57] "GET /" 200 5801

Is there anything else I may be doing wrong? Is it because I have 
"localhost" in my CHANNEL_LAYERS in CONFIG?

-- 
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/3d7cc02b-8ab5-4463-9082-31c89cbf6fe1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels, Nginx, Daphne - Not working?

2017-05-02 Thread Alex Elson
I have  "socket = new Websocket("ws:// ...", "socket.onopen," and 
"socket.send" commands in my Javascript code, and although the Javascript 
works, it seems to not be able to run these commands, or it is unable to 
access my functions in consumer.py, althought it works flawlessly if I run 
my project locally.

-- 
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/f9bc1728-d281-4245-8960-42c1770f8281%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.