Re: django cms beginner app issue

2019-03-26 Thread Avraham Serour
you model doesn't have app_config

On Tue, Mar 26, 2019 at 1:07 AM Keegen Knapp  wrote:

> I'm trying to write a custom app where you can add new plants in the
> admin. Then create a list view, category view and detailed view. You can
> see my error and code below. Any help is greatly appreciated!!
>
> Error -
>
> [image: Screen Shot 2019-03-25 at 11.25.09 AM.png]
>
>
> models.py -
>
> from django.db import models
> from cms.models.fields import PlaceholderField
> from django.db.models.signals import pre_save
>
> #create a basic species model
> class Species(models.Model):
> name = models.CharField(max_length=50, unique=True)
> def __unicode__(self):
> return self.name
>
> class Plant(models.Model):
> name = models.CharField(max_length=50, unique=True)
> #textfield to choose season
> season = models.TextField()
> #automatically adds a created date, good for ordering plants by dates etc
> pub_date = models.DateField(auto_now_add=True)
> #automatically adds slug, requires Auto slug
> slug = models.SlugField(max_length=70, unique=True)
> #FK's to a species model
> species = models.ForeignKey(Species)
> #life cycle
> life_cycle = models.CharField(max_length=60)
> #add a upload section for specification sheets
> position = models.TextField()
> #take advantage of the CMS's placeholders for images, much more flexible
> than file_upload
> image = PlaceholderField('plant_images', related_name="image")
> #again description, take advantage of the CMS capabilities.
> description = PlaceholderField('plant_description',
> related_name="description")
>
>
> *views.py*
>
> from django.shortcuts import render_to_response
> from django.template import RequestContext
>
> class ProductDetailView(DetailView):
> model = Plant
> template_name = 'plants/detail.html'
>
>
> *urls.py*
> from plants.views import PlantDetailView
>
> urlpatterns = patterns('plants.views',
> url(r'^(?P[\w-]+)/$', PlantDetailView.as_view()),
> )
>
>
> *cms.app.py  -*
>
> from cms.app_base import CMSApp
> from cms.apphook_pool import apphook_pool
> from django.utils.translation import ugettext_lazy as _
>
> class PlantsApp(CMSApp):
> name = _("Plants") # give your app a name, this is required
> urls = ["plants.urls"] # link your app to url configuration(s)
>
> def get_urls(self, page=None, language=None, **kwargs):
> return ["plants.urls"]
>
> apphook_pool.register(PlantsApp) # register your app
>
> *apps.py - *
> class PlantsConfig(AppConfig):
> name = 'plants'
> verbosename = "Plants"
>
> *admin.py - *
> from django.contrib import admin
> from .models import Plant, Species
> from aldryn_apphooks_config.admin import ModelAppHookConfig,
> BaseAppHookConfig
>
> class PlantAdmin(ModelAppHookConfig, admin.ModelAdmin):
> search_fields = ['name']
> readonly_fields = ['slug']
> ordering = ['name']
> pass
> admin.site.register(Plant, PlantAdmin)
>
>
> class SpeciesAdmin(admin.ModelAdmin):
> search_fields = ['name']
> ordering = ['name']
> pass
> admin.site.register(Species, SpeciesAdmin)
>
> --
> 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/f5c0d1e5-3962-48ce-8fdc-a082c37ddba5%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/CAFWa6tK8hny1LH%3D5JzkrpiD4DRTRF9yk%3DhbeV9eW-w6GTWwSMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Best option for wrapping a wsgi app

2019-02-20 Thread Avraham Serour
I recommend nginx+uwsgi


On Tue, Feb 19, 2019 at 3:09 PM Anton Melser  wrote:

> Hi,
>
> I searched high and low but my Google-foo must be lacking. I want to wrap
> a wsgi app (https://github.com/tsudoko/anki-sync-server) and serve it
> under my Django site. After wasting large amounts of time working around
> this thinking it wasn't possible, I stumbled across
> https://github.com/2degrees/django-wsgi, which does the trick nicely (at
> least it appears to for what I need, though I have only tested locally).
> Unfortunately, the last commit was 3-4 years ago, and it doesn't support
> Django 1.10+ (is_authenticated() vs is_authenticated). I have submitted a
> PR and am currently using a fork but the project appears completely dead.
>
> What are other people using, if anything?
>
> Cheers,
> Anton
> --
> echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq' | dc
> This will help you for 99.9% of your problems ...
>
> --
> 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/CAKywjPrsXNN1ve8PFYr9M%2BpbTHqA4T2xuwPAm%3DmJR13trp2meQ%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/CAFWa6t%2BYGDV3E_wrkqvHqwBu9kRvzvANdbfO_drxYrfKEkJj4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using {% include %} and getting context with me

2019-02-13 Thread Avraham Serour
Maybe you can solve this using a templatetag?

On Wed, 13 Feb 2019, 16:47 Mikkel Kromann  Hi.
>
> I have a collection of apps where I find repeating myself when rendering
> tables in the templates.
> In the stylised example below I have three types of tables, foo, bar and
> baz.
> Each app is supposed to render various combinations of tables from its own
> models, but also from other models' tables.
> (yes, it is a hideously complex structure - and believe me, I've tried to
> simplify it a lot - even with some success)
>
> Can I - in a page which extends a base, include various "template
> snippets", so that I can reuse the template snippets across several apps?
>
> base.html:
> 
> ...
> 
>
> my_page1.html:
> {% extends "base.html" %}
>
> {% block foo %}
> {% include foo.html %}
> {% endblock % }
>
> {% block bar %}
> {% include bar.html %}
> {% endblock % }
>
> {% block baz %}
> {% include baz.html %}
> {% endblock % }
>
> foo.html:
> {% if foo_context %}
> 
> {% endif %}
>
> bar.html:
> {% if bar_context %}
> 
> {% endif %}
>
> baz.html:
> {% if baz_context %}
> 
> {% endif %}
>
> As I understand, the snippets are evaluated without the context of
> my_page1.html, right (e.g. foo_context).
> The docs (
> https://docs.djangoproject.com/en/2.1/ref/templates/builtins/#include)
> seem to suggest that I could work around the context problem by writing:
>
> {% include foo.html with foo_context=foo_context %}
>
>
> Is that correctly understood in this case?
>
>
> thanks, Mikkel
>
>
>
> --
> 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/8b0eca46-1d00-4bdd-8aba-d8d3a2043a1b%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/CAFWa6tK_J%3Dot4_rZx8n%3Dfv5R%3DBazDHCUrk1NQCxtGw5PfZVMEg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django on IIS

2018-12-18 Thread Avraham Serour
I feel your pain, once I had to deploy a django project on windows, after
trying many different options I installed cygwin and form there nginx+uwsgi
like any other normal person.

Today microsoft have WSL, I think you may use that too, you can still use
IIS to route traffic and forward the http connections. Maybe not as
efficient as it could be but I think it will save you headaches.

Good luck

On Tue, Dec 18, 2018 at 6:10 AM Mike Dewhirst  wrote:

> On 18/12/2018 2:16 PM, Alex Heyden wrote:
> > I have recently, and it was equal parts misery and pain. FastCGI via
> > wfastcgi, as outlined at
> >
> http://blog.mattwoodward.com/2016/07/running-django-application-on-windows.html
> >
> > I also had to downgrade from Python 3.7 to Python 3.6
> >
> > I wouldn't really consider myself an expert on the subject. All I can
> > say is that it is possible.
>
> I once had to implement a web service on a Windows server and eventually
> installed Apache. That worked brilliantly although it wasn't a heavy
> duty application. Django works well on Windows so Apache is a fallback
> if IIS doesn't cut it for you.
>
>
> >
> > On Mon, Dec 17, 2018 at 5:19 PM Larry Martell  > > wrote:
> >
> > Anyone have any experience setting up a Django app to work with IIS?
> I
> > have inherited what I was told is a working system, but it's not
> > working. Before I post details of my issues and questions I wanted to
> > see if anyone here has successfully got a Django app to run with IIS.
> >
> > --
> > 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/CACwCsY7bk-c7Za-PGUbaEkftA8Xxqd%2BaCUPkaQryW-1kXX0_nQ%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/CA%2Bv0ZYVWO5bFTx%3D6im_dLWwPWz1FoDcFVDN9GXREj%3Dp49f2FcA%40mail.gmail.com
> > <
> https://groups.google.com/d/msgid/django-users/CA%2Bv0ZYVWO5bFTx%3D6im_dLWwPWz1FoDcFVDN9GXREj%3Dp49f2FcA%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/6f7de077-4082-db30-1cca-168cbce7952c%40dewhirst.com.au
> .
> 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/CAFWa6tJta-WGGnfsMn5OKB3GsqzPh%2B73L4kH-KiefjNAA44FbQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to delete least recently used not expired django sessions?

2018-08-20 Thread Avraham Serour
maybe something like this could be useful for your use case:
https://pypi.org/project/django-session-timeout/
it has an option for SESSION_EXPIRE_AFTER_LAST_ACTIVITY


maybe this could also be useful for you:
https://django-session-security.readthedocs.io/en/latest/



On Mon, Aug 20, 2018 at 8:34 AM Web Architect  wrote:

> Hi Jason,
>
> Thanks for your response.
>
> As mentioned in my earlier post...I have a long expiry date for the
> sessions (and hence, the cookies)  as we want our users to be always logged
> in or in session (till they clear their cookies). And that's what is
> causing the issue.
>
> The goal is to keep the regular users logged in whereas flush out the non
> active users (even if their sessions haven't expired). Hence, was looking
> for a solution for the same.
>
> Thanks.
>
> On Saturday, August 18, 2018 at 5:39:19 PM UTC+5:30, Jason wrote:
>>
>> With database sessions out of the box, no.
>>
>>
>> https://github.com/django/django/blob/master/django/contrib/sessions/base_session.py
>>
>> You can see there are three attributes for a session model: key, data and
>> expire_date
>>
>> That said, since sessions are backed by browser cookies, django's default
>> is two weeks for session cookies as you can see at
>> https://docs.djangoproject.com/en/2.1/ref/settings/#std:setting-SESSION_COOKIE_AGE,
>> which are used here:
>> https://github.com/django/django/blob/master/django/contrib/sessions/backends/base.py#L225-L244
>>
>> So if you haven't altered that, all sessions expire in two weeks, and you
>> can just delete those expired sessions by using the clearsessions
>> management command
>> 
>> .
>>
>> if you have changed that, then what Hemendra suggested above seems like a
>> reasonable approach, but one that is not backwards compatible if you don't
>> have a timestamp field for last access
>>
>>
>> --
> 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/4794450f-ad83-4a00-96e3-f354745b322b%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/CAFWa6tK3vsiDj-zX62tNN9KMVbgd8wy4knEwL2BimYP_THfx9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django wamp

2018-07-08 Thread Avraham Serour
yes, it is possible.

You are correct, they need to listen to a different port

On Sun, Jul 8, 2018 at 9:24 AM Gerald Brown  wrote:

> Is it possible to run 2 servers (Apache & Nginx) on the same system?
>
> Maybe if they listen on different ports i.e. 80 & 81
>
> On Sunday, 08 July, 2018 01:09 PM, m1chael wrote:
>
> best not to fight Apache and just use nginx for django
>
> On Sat, Jul 7, 2018, 11:07 PM  wrote:
>
>>
>> Hi,
>> I'm a novice with django but have been setting up django on a Win7 Wamp
>> stack.  We have several small non-django websites running on wamp.
>> Those projects are in c:/wamp/www/myproject for ex. and are accessed as
>> localhost/myproject or myipxxx/myproject.
>>
>> Under wamp I have tried putting the django project in c:/wamp/apps, in
>> c:/wamp/www, and just in c:/wamp too.  They all work fine with apache and
>> mod_wsgi.
>> At least I get a sample "helloworld" message in the webpage when I access
>> the django site as localhost/mydjangosite or myipxxx/mydjangosite.  This is
>> basically the simple tut01 or polls app kindof django project.
>>
>> But the django project, wherever I put it in wamp, buggers our other
>> non-django websites.  I get a message back from urls.py saying it's been
>> thru all the urls listed and it cannot access our regular (non django
>> sites) in c:/wamp/www when I try to access one as localhost/myproject or
>> myipxxx/myproject from the browser.
>>
>> I'm a bit stuck on how to get these two to play together nicely.  I'm not
>> sure if it's a django project configuration, an apache httpd.conf problem,
>> or a wamp issue.  I'm wondering if someone has experience with this issue
>> and could point me in the right direction for how to use django, but
>> continue to use localhost or myipxxx/ to access our non-django wamp sites.
>>
>> Thank you,
>> Bob
>> --
>> 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/f9e69bf3-5192-41b9-9b80-d80617c9f5d9%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/CAAuoY6Nan7vxHE%3DLXAMYnMhh58%3DiV6DwFxQnt0FPBd7vvS6J_w%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/c1af585f-19c4-5cd0-7697-e167726ae65e%40gmail.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/CAFWa6tKG03DWOSPOA78ex5CJSdcfN8x3sQrjLA%2BcrpGvhpacPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django performances issue

2018-05-02 Thread Avraham Serour
How many workers do you have?
What those requests do? Even 3 minutes sounds like too much, do they just
query from the DB and render a template?
How caching didn't help? did you count the cache miss/hit? What are you
caching?

On Wed, May 2, 2018 at 3:59 PM, prakash sharma 
wrote:

> I have developed the API using DRF but facing the major performances issue.
>
> Here is what the scenario is: I am using DRF. Our API call is growing
> towards 5k per day. Each API call is taking 3 to 10 minutes of time while
> responding ( as It creates upto 300 pdf label unique format)
>
> I am using uwsgi( many worker) now with the Apache.
>
> We have implemented the caching but not able improve very much
> performances level.
>
> Primary query:
>
> Shall we use gunicorn instead of uwsgi? What about message/ job queue? Is
> this work.
>
> My current server RAM is only 32 GB. Shall I have to increase this if yes
> how much ( we personal don't want to go for vertical scaling)
>
> Please suggest the approach, first time I am handling such level of
> performance issue.
>
> I am very optimistic about message/ job queue and gunicorn.
>
> --
> 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/86e487d8-6dfe-4049-89a6-5e90a9175d48%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/CAFWa6tKk5HwduoRVkz-7tCx48Udqg8QQW73%2BGB14TTtuUPfcxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django dependecies

2018-05-02 Thread Avraham Serour
The admin app uses it, you can make your app without worrying about it, one
won't affect the other

On Wed, 2 May 2018, 14:09 Mauro Ribeiro, 
wrote:

> Hi,
>
> Why does django include jquery?
>
> django/django/contrib/admin/static/admin/js/vendor/jquery/jquery.js
>
> What use does it make of it?
> I cant have that version of jquery in my app so I want to know that
> impacts of jquery on django.
>
> 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/542460bf-3dee-480a-b0ea-7716671a3fd7%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/CAFWa6tK4jJxg%2ByKGbX4rJvT47rCV-mVF5ejGmpwf_SndOnCFAQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Do you know good guides to use ajax in django

2018-04-26 Thread Avraham Serour
I suggest taking a look at http://intercoolerjs.org


On Thu, Apr 26, 2018 at 7:36 AM,  wrote:

> Im starting a social network for my school and i need to show the coments
> of my post without recharging the whole and for other things in my proyect
>
> --
> 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/de939dae-605d-4cf1-9a7a-e5ee48f249ed%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/CAFWa6tJL4DykA-54hXLEuzi9q1Fz_XHzbX7b9BbrtfYRS9dUcQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Porting from Cookie based authentication to JWT (except admin portal)

2018-04-24 Thread Avraham Serour
I wouldn't use two settings to only achieve this, you can add multiple auth
classes which django will try in a loop.

You can add the JWT and a custom class which can baseclass the
login/password auth and only allow superusers to login

On Tue, Apr 24, 2018 at 6:18 PM, Prakash D  wrote:

> Hi I'm trying to port an existing application (which uses Django admin
> portal) to JWT authentication system so I can support native mobile
> clients.
>
> My proposed solution is having two manage.py files (will run on seaparate
> port numbers) and two settings.py files which will have different url
> routing. Is this the only way to do it?
>
>
>
> 
>
> --
> 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/be19d2d1-d912-4780-a462-53d5e7da7595%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/CAFWa6tLXtmSYT%3D8pZhc9KhRh8Bf1W8UMqarknDyefWS3OErThQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: retain form data when a user session expires while filling a form

2018-04-13 Thread Avraham Serour
You may also always save to cookie before submitting the form and clear it
on the thank you page

On Thu, 12 Apr 2018, 14:20 Vijay Shanker,  wrote:

> I have to code this scenario:
>
> Some user comes to fill a form and while user is at it, session expires;
> User tries to submit form, as session has expired it will take him to login
> page after which he is rediredted to form page with a prefilled form with
> data he filled previously.
>
> my propsed solution: on form submit, check if user session is expired with
> an ajax call, if yes, drop a cookie with values of filled form, user comes
> back to same form, prefill the form from cookie value.
>
> how far I got: not much; I used ajax call to check session expiry with a
> backend call to this function:
>
> def check_valid_session(request):
> session_expiry_date = request.session.get_expiry_date()
> now = datetime.now()
> seconds_left = (session_expiry_date - now).total_seconds()
> if seconds_left <= 0:
> return JsonResponse({'session_expired': True, 'seconds_left': 
> seconds_left })
> else:
> return JsonResponse({'session_expired':False, 'seconds_left': 
> seconds_left})
>
> in my settings I have:
>
> SESSION_COOKIE_NAME = "sso-sessionid"
> SESSION_COOKIE_HTTPONLY = False
> SESSION_COOKIE_AGE = 10
> SESSION_COOKIE_DOMAIN = '.mydomain.com'
> SESSION_COOKIE_SECURE = True
> SESSION_EXPIRE_AT_BROWSER_CLOSE = True
>
> but in response, I always get seconds_left as something close to 9.999.
> and session_expiry_date keeps increasing itself by 10 seconds each time i
> hit submit and call the backend code above. How to get correct session
> expire time?
>
> --
> 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/e623b707-2014-4511-91f4-7a00420fe196%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/CAFWa6tLyCywv3sZn%3D2ch9fdrxBLv-PCRdqPS3CK5ioiimypobg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django blocking on writing logs

2018-04-10 Thread Avraham Serour
it doesn't seem to have any relation to a synchronous logger

On Tue, Apr 10, 2018 at 1:16 AM, Ameni Bejaoui <amenibejaoui...@gmail.com>
wrote:

> I face this problem when i want to test the django interface in the web
> browser local domain :/ what should i do ? i change even the port to 8080
> the same problem
>
> 2018-04-09 20:27 GMT+01:00 Avraham Serour <tovm...@gmail.com>:
>
>> It seems you are right, I found this SO thread dealing with the same
>> question: https://stackoverflow.com/questions/34349797/are-
>> log-statements-blocking-in-django-python
>>
>> In pratical terms I use sentry, the python client claims to use a
>> threaded async approach, I suggest taking a look at their implementation,
>> or just plugging sentry to your app.
>>
>> On Thu, Apr 5, 2018 at 7:51 PM, Daniel Arndt <danielar...@gmail.com>
>> wrote:
>>
>>> Hi all,
>>>
>>> Although not explicitly mentioned anywhere, I've come to the conclusion
>>> Django blocks while writing logs with some handlers (it uses Python
>>> logging, https://docs.python.org/3/howto/logging-cookbook.ht
>>> ml#dealing-with-handlers-that-block).
>>>
>>> I can't find anything that explicitly states Django handles this already
>>> (in the code or documentation) and I believe it to be a problem in the
>>> platform I am working on. Justification for this belief is loose at best,
>>> but it's the best lead I have (specifically, the SysLogHandler seems like
>>> it might be blocking on sending to a UDP port, which seems crazy but
>>> apparently is possible)
>>>
>>> I'm setting trying to see if I can solve this, but there seems to be
>>> very little details on this subject, and that alone worries me. So I have a
>>> couple questions for anyone willing to entertain me:
>>>
>>>
>>>1. Is it silly to be worried about this? My gut says yes, simply
>>>because nobody else is. At the same time I see no real downside to 
>>> logging
>>>asynchronously (is that true?). There are potential upsides. It might not
>>>solve the real problem (what is causing buffers to back up in the first
>>>place? likely crazy I/O usage) but it might speed up handling of requests
>>>during heavy I/O.
>>>2. Have you done anything similar to this? How did you approach it?
>>>3. The QueueHandler suggested in the Python cookbook doesn't seem to
>>>be easy to stuff into Django. We have Django running behind Gunicorn, so 
>>> my
>>>thought was to have Gunicorn spin up a QueueListener process, and then 
>>> have
>>>Gunicorn pass the queue to each worker similar to this cookbook:
>>>https://docs.python.org/3/howto/logging-cookbook.h
>>>tml#logging-to-a-single-file-from-multiple-processes
>>>
>>> <https://docs.python.org/3/howto/logging-cookbook.html#logging-to-a-single-file-from-multiple-processes>
>>>-- I'm interested on any thoughts on this approach. Especially if there 
>>> is
>>>a better way.
>>>
>>> Cheers,
>>> Dan
>>>
>>> --
>>> 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/ms
>>> gid/django-users/ce269c78-bd6b-4e06-b9de-2da6ccc79cd8%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/ce269c78-bd6b-4e06-b9de-2da6ccc79cd8%40googlegroups.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/ms
>> gid/django-users/CAFWa6tKBZ5Nq8BwOVBWxpyg%3DS6nzV_%3DhXF_
>> km9A-bT_pFXfbtw%40mail.gmail.com
>> <

Re: username and allowed alphanumeric, why?

2018-04-10 Thread Avraham Serour
It seems you read that wrong, usernames may contain alphanumeric and other
characters.


On Tue, Apr 10, 2018 at 12:10 PM, Stefano Tranquillini <
stefano.tranquill...@gmail.com> wrote:

> Hi all,
>
> mostly curiosity, why does the username https://docs.djangoproject.
> com/en/1.11/ref/contrib/auth/#django.contrib.auth.models.User.username
> allow only _, @, +, . and - characters?
> is there a reason for that?
>
>
> --
> 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/62ca69fe-ca26-4b48-ac19-4f4887dce08a%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/CAFWa6t%2BU_gYm4ykyeQ9buUSgnkD0ZzD9oGOwdYwEFQkdiam8mg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: serializers

2018-04-09 Thread Avraham Serour
Can you phrase the question better? The way it is written makes it hard to
understand exactly what you need here.

On Thu, Apr 5, 2018 at 5:33 PM, siva.gatti  wrote:

> how to add created_by_id to serializers in django rest rest frame work and
> created_by_id is stored in session when the user is logged in
>
> --
> 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/da03a487-000b-42cb-9d72-da0969429889%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/CAFWa6tJFuaVnQ-5w_kQeJB99_8U_h6RwVEJH0gdxoK5zfDA_mQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help: 'django.utils.six.moves' is not a package

2018-04-09 Thread Avraham Serour
sounds like django 2 removed six and some library you are using still hopes
it exists.

what django version are you using?

On Mon, Apr 9, 2018 at 3:39 AM, Derek Zeng  wrote:

> I got the following error when running pytest in django. Help is
> appreciated.
>
> This is the test I run
>
> import pytest
> from .factories import *
>
> @pytest.mark.django_db
> def test_with_client(client):
>   PostFactory.create() # if commented out, the error is gone
>   response = client.get('/')
>
>   body = str(response.content)
>   assert 'Mysite' in body
>
> PostFactory creates a Post object in the database
>
>
> apps/blog/tests/test_post.py:5 (test_with_client)
> client = 
> @pytest.mark.django_db
> def test_with_client(client):
> p = PostFactory.create()
>
> > response = client.get('/')
> blog/tests/test_post.py:10:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _
> ../../../../.virtualenvs/django/lib/python3.6/site-
> packages/django/test/client.py:517: in get
> response = super().get(path, data=data, secure=secure, **extra)
> ../../../../.virtualenvs/django/lib/python3.6/site-
> packages/django/test/client.py:332: in get
> return self.generic('GET', path, secure=secure, **r)
> ../../../../.virtualenvs/django/lib/python3.6/site-
> packages/django/test/client.py:404: in generic
> return self.request(**r)
> ../../../../.virtualenvs/django/lib/python3.6/site-
> packages/django/test/client.py:467: in request
> response = self.handler(environ)
> ../../../../.virtualenvs/django/lib/python3.6/site-
> packages/django/test/client.py:125: in __call__
> self.load_middleware()
> ../../../../.virtualenvs/django/lib/python3.6/site-
> packages/django/core/handlers/base.py:37: in load_middleware
> middleware = import_string(middleware_path)
> ../../../../.virtualenvs/django/lib/python3.6/site-
> packages/django/utils/module_loading.py:17: in import_string
> module = import_module(module_path)
> ../../../../.virtualenvs/django/lib/python3.6/importlib/__init__.py:126:
> in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
> :994: in _gcd_import
> ???
> :971: in _find_and_load
> ???
> :955: in _find_and_load_unlocked
> ???
> :665: in _load_unlocked
> ???
> :678: in exec_module
> ???
> :219: in _call_with_frames_removed
> ???
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _
> from __future__ import absolute_import
>
> import re
>
> from django import http
> from django.apps import apps
> from django.utils.cache import patch_vary_headers
> > from django.utils.six.moves.urllib.parse import urlparse
> E ModuleNotFoundError: No module named 'django.utils.six.moves.urllib';
> 'django.utils.six.moves' is not a package
> ../../../../.virtualenvs/django/lib/python3.6/site-packages/corsheaders/middleware.py:8:
> ModuleNotFoundError
>
> --
> 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/23957c7e-9aca-4494-a06a-20cbf0fc857b%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/CAFWa6tJVq15fdBc8u%3DP6tRsrJo5D0sHNQtZh1a6U2y4uNm38mw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pant builds with django

2018-04-09 Thread Avraham Serour
what is pant builds?

On Thu, Apr 5, 2018 at 11:24 PM, Allan Nava  wrote:

> Is possible use pant builds with django?
>
> --
> 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/079d7aeb-9666-4b49-a50c-cf469f1a5537%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/CAFWa6t%2BH3SM6U8X-Sq819bTG1p2Zy0g%2BDWsgneQNo1D5w2Rb-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django blocking on writing logs

2018-04-09 Thread Avraham Serour
It seems you are right, I found this SO thread dealing with the same
question:
https://stackoverflow.com/questions/34349797/are-log-statements-blocking-in-django-python

In pratical terms I use sentry, the python client claims to use a threaded
async approach, I suggest taking a look at their implementation, or just
plugging sentry to your app.

On Thu, Apr 5, 2018 at 7:51 PM, Daniel Arndt  wrote:

> Hi all,
>
> Although not explicitly mentioned anywhere, I've come to the conclusion
> Django blocks while writing logs with some handlers (it uses Python
> logging, https://docs.python.org/3/howto/logging-cookbook.
> html#dealing-with-handlers-that-block).
>
> I can't find anything that explicitly states Django handles this already
> (in the code or documentation) and I believe it to be a problem in the
> platform I am working on. Justification for this belief is loose at best,
> but it's the best lead I have (specifically, the SysLogHandler seems like
> it might be blocking on sending to a UDP port, which seems crazy but
> apparently is possible)
>
> I'm setting trying to see if I can solve this, but there seems to be very
> little details on this subject, and that alone worries me. So I have a
> couple questions for anyone willing to entertain me:
>
>
>1. Is it silly to be worried about this? My gut says yes, simply
>because nobody else is. At the same time I see no real downside to logging
>asynchronously (is that true?). There are potential upsides. It might not
>solve the real problem (what is causing buffers to back up in the first
>place? likely crazy I/O usage) but it might speed up handling of requests
>during heavy I/O.
>2. Have you done anything similar to this? How did you approach it?
>3. The QueueHandler suggested in the Python cookbook doesn't seem to
>be easy to stuff into Django. We have Django running behind Gunicorn, so my
>thought was to have Gunicorn spin up a QueueListener process, and then have
>Gunicorn pass the queue to each worker similar to this cookbook:
>https://docs.python.org/3/howto/logging-cookbook.
>html#logging-to-a-single-file-from-multiple-processes
>
> 
>-- I'm interested on any thoughts on this approach. Especially if there is
>a better way.
>
> Cheers,
> Dan
>
> --
> 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/ce269c78-bd6b-4e06-b9de-2da6ccc79cd8%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/CAFWa6tKBZ5Nq8BwOVBWxpyg%3DS6nzV_%3DhXF_km9A-bT_pFXfbtw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reporting for Django 2

2018-04-09 Thread Avraham Serour
Do you have a question or just sharing?

On Sat, 7 Apr 2018, 1:33 ,  wrote:

> Hi
>
> I've been trying different django reporting packages with no success
>
> Apparently, all of them are developed for versions previous than Django 2.0
>
> Any help will be appreciated
>
> José
>
> --
> 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/d176707c-b267-4730-8913-ab68b9dc64c3%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/CAFWa6t%2Bn2_r3JrwUKUVg-RLkb8aDqK7Q28fc-4VTuAgJtZmNpg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: I'm trying to edit address form for Saleor ecommerce platform

2018-04-08 Thread Avraham Serour
You seem to have pasted a line from your template, not the error you are
getting, no way of helping you there.

Please post the actual error you are getting

On Sat, Apr 7, 2018 at 2:00 PM, ruslan.aldar  wrote:

> hello.
> I'm trying to build an local merchant website. So I don't know how to edit
> address form for Saleor. It uses google i18n address form.
> and when i'm trying to delete some fields like company_name, city
> city_area, postal_code, country, country_area, i'm having problem.
>
> on the page : http://localhost:8000/checkout/shipping-address/
>
> i'm getting
> {% with address_form_lines=address_form.i18n_fields_order %}
> this kind of error.
>
> Making migration doesn't solve the problem and I don't know why it's
> requesting the field which is doesn't exist!  I even tried deleting DB,
> migrating again!
>
> If someone knows it please tell me.
> Thank you.
>
> --
> 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/5f44cebc-915e-4c08-b394-13efc4ca5c0c%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/CAFWa6t%2BAX%3D_TGh5LLa-RyX9Xc9Y_YVm-iL965d3r1DkcK4zU2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: models that are not tables but not abstract

2018-03-29 Thread Avraham Serour
Currently for things like this I create a view and serializer that are not
related to any model.

Of course I lose some introspection code that expect a model, but for the
most part I'm able to make an API endpoint with data not from the ORM.

Can you elaborate more on your use case?

On Thu, Mar 29, 2018 at 12:51 PM, Younes Ch  wrote:

> I have this recurrent need that I handle entities that are not tables but
> calculated entities from other models.
>
> Consider this example :
> an entity that I call task that is calculated using the model suggestion a
> task may be to approve a suggestion, to pilot a suggestion, to close a
> suggestion. the task model can't be in the database but it is handled
> exactly like a model (it has fields that are calculated from other models,
> it should have views, serializers using DRF).
>
> Problem
> Since there is no way in django to handle this kind of entities as models
> I need to make exception to make it follow same process as other models
> except the fact that it is not in the database.
>
> It would be great to find a way to integrate this in the next django
> version
>
> --
> 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/991cdfe4-7451-4708-a53f-544d255a01d8%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/CAFWa6t%2B3Xi3vE3DyTRKRjcMAewEZEtcJkVzA-b0HHP30gbnSSg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error After Inspect db

2018-03-13 Thread Avraham Serour
it seems you wrote def_str_, if should be def (space) then the function name

also the function str should probably be named with double underscores like
this: __str__ not _str_

On Tue, Mar 13, 2018 at 5:27 PM, mansi thakkar 
wrote:

> Hello ,
> Here is the attached files of my output and my error and my models.py
> file. I have database residing in aws cloud platform. What I have done is I
> have used inspectdb command and created models using that command. Then
> have registered my model into admin site and then model has been displayed
> (Ingredient in my case.) Now it is showing Ingredient object for each and
> every entry as shown in pic I would like to display master_name instead og
> ingredient_name. How can I do that?
> Please reply me as soon as possible.
> Thank you.
>
> --
> 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/d9fe676d-9988-4f59-a97f-fdc5db777e39%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/CAFWa6tJo-jNjU%3DS62UgnTV%3DERu4-w4xe-JcoUT2hgJf2s7e6tA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django server and client communications

2018-03-04 Thread Avraham Serour
I suggest using DRF, It can autogenerate the schema which can be useful.

It seems they also have a client to consume that, worth taking a look

On 4 Mar 2018 21:58, "Richard Maceček"  wrote:

> Hello, I need help with client and server communications. Web Application
> - Djang Server Side. The client is written in python, it's actually a KODI
> add-on.
>
> They need to deal with:
>  1. client authorization,
>  2. communications,
>  3. data transfer.
>
> I need to send the data I receive from the client to the server.
>
> What would I use? I was thinking about JSON (websocket) or XML. Or
> Django-rest-framework? Another idea?
>
> Thank you Best regards
> M.R
>
> --
> 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/61ee09a1-ae0e-4415-9180-9702020e73ec%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/CAFWa6t%2B-OyTYBfANt0d8Kb1GVmALPUNGctgz8xagsTg47o%3DYgA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-hotsauce: Current status and roadmap

2018-01-31 Thread Avraham Serour
Why do you call it microframework?

You should prove it is high performance, benchmark, measure, compare and
show some cool graphs

I already have a Django project, is it a drop in replacement?
My project uses python 3.6 while you only have experimental support for
3.5. I'm not going back, you should have already experimental support for
3.7 at least

On 31 Jan 2018 12:35, "Etienne Robillard"  wrote:

> Hi everyone,
>
> This is a quick post to present the current state of development in
> Django-hotsauce, a high-performance and scalable WSGI microframework on top
> of Django and others.
>
> Django-hotsauce has now reached the 0.9 milestone. New major features now
> supported includes:
>
>- uWSGI support with Gevent loop engine
>- Full ZODB databases support through the Schevo DBMS
>- OAuth2 authentication and authorization support with thread-local
>request storage based on Werkzeug
>- Experimental PyPy 5.9 and CPython 3.5 support
>- Backward compatibility with Django 1.4 and Django 1.11
>
> What should be done next? How can Django-hotsauce attract a larger
> audience?
>
>
> Best regards,
>
> Etienne
>
>
>
> --
> Etienne Robillardtkadm30@yandex.comhttps://www.isotopesoftware.ca/
>
> --
> 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/680aff87-b96d-7a55-4515-a1762e02f5de%40yandex.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/CAFWa6tLoNEdTwg39nWdR2N6XxQN4PLy%2BpWve0UwKwakJen1FAA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: javascript transpilers

2018-01-28 Thread Avraham Serour
If you don't want and don't have the time to learn JS you may as well
consider outsourcing the frontend work, I've worked in places that did just
that and everybody was happy, the internal team liked python and the
outsourced company people liked UX and JS.

On Sun, Jan 28, 2018 at 6:09 PM, Jani Tiainen  wrote:

> Hi,
>
> You don't describe to what extent you need to use JavaScript - IOW, what
> problem you need to solve with JavaScript?
>
> Depending you needs you might get away with basic knowledge and usage of
> some helpful JavaScript library/framework.
>
> On Sun, Jan 28, 2018 at 12:44 AM, Mike Dewhirst 
> wrote:
>
>> I have avoided javascript like the plague. However it seems I have to
>> bite the bullet. Interestingly, there are now a number of Python ->
>> Javascript transpilers.
>>
>> http://stromberg.dnsalias.org/~strombrg/pybrowser/python-browser.html
>>
>> Where would be a good place to start a discussion on the topic?
>>
>> I am self-employed  with multiple demands on my time so I cannot afford
>> to allocate sufficient time to learn it let alone undertake formal
>> Javascript training. My hope is to pick it up by osmosis and wonder if a
>> transpiler would help.
>>
>> Thanks for any pointers
>>
>> 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/ms
>> gid/django-users/fa0e9f0b-fece-344d-74f2-5b9470b40657%40dewhirst.com.au.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Jani Tiainen
>
> - Well planned is half done, and a half done has been sufficient before...
>
> --
> 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/CAHn91od4EbPY210baiuJq59cf2nEu
> e6TQ1-3wiU8auk-uLKCYQ%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/CAFWa6tJ_kfQ6RdW_d_QmXXTPt%2Bpt7HKPtnt_7eie17O60yaoaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django 2 under python 2

2018-01-25 Thread Avraham Serour
> I wonder why this is happening...
because django 2 doesn't support python 2

I suggest using python 3.6

On Thu, Jan 25, 2018 at 9:50 PM, Andy  wrote:

> Hi!
>
> pip inside a python2 virtualenv will try to install django 2, which aint
> working and will fail.
> I wonder why this is happening because for instance if i install ipython
> in that same virtualenv pip wont try to install version 6.x because its
> marked as python3 only. It seems django 2 is missing some soft of flag that
> is present at the ipython package and tells pip to install the old ipython
> 5.5 rather than anythin above that.
>
> Does anyone know whats causing this?
>
> --
> 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/eed0e673-56e9-476b-9030-b81a18c531a8%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/CAFWa6tKhcj1Mauf967dL6-bfypih7L7-r1XkLEyb6Oa5QizEMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Will django include a simpler way to change username to email for registration in the future ?

2018-01-24 Thread Avraham Serour
someone posted an app for that here w while ago:

http://django-improved-user.readthedocs.io/en/latest/index.html



On Wed, Jan 24, 2018 at 1:23 AM, Vijay Khemlani  wrote:

> I have been using django-custom-user for that without any issues
>
> On Tue, Jan 23, 2018 at 6:43 PM, Daniel Cîrstea <
> daniel.cirste...@gmail.com> wrote:
>
>> Hello. For a while I noticed that it is a struggle to extend the
>> AbstractBaseUser in order to change user to email for registration and
>> login. Takes time and it is a lot of code. I was wondering if django will
>> include a simpler way of doing it ? Something simple like just changing a
>> settings.py variable to email and boom, u can create accounts with email
>> address.
>>
>> --
>> 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/ms
>> gid/django-users/606c63a3-792a-4827-8211-1d4be998cc2a%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/CALn3ei0evyKJEEkSabqRTNOEKRnRnyLqYi1SLHyauvvE%2Bk2oPg%
> 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/CAFWa6tLw4r-Ejk-VAeVgo-ZF2orzGtWY%2BGRYXQ2ZOcJ4YB-%2BHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to autoGenerate C bindings for Django 1.11 ?

2018-01-24 Thread Avraham Serour
please try and share your findings, I'm sure I'm not the only one curious
about this


On Wed, Jan 24, 2018 at 11:21 AM, Etienne Robillard <tkad...@yandex.com>
wrote:

> Hi Avraham
>
> On Tuesday, 23 January 2018 17:18:19 UTC-5, Avraham Serour wrote:
>>
>> Did you try doing this and see what happens?
>>
>
> Not yet. But I presume I could just use the libdjango.so shared library as
> a replacement for the django package?
>
> Regards,
>
> Etienne
>
>>
>> On 23 Jan 2018 9:56 PM, "Etienne Robillard" <tka...@yandex.com> wrote:
>>
>>> Can I create a file named libdjango.pyx with the following code:
>>>
>>> {{{
>>>
>>> import django
>>>
>>> from django import *
>>>
>>> }}}
>>>
>>> Then compile the C file with gcc to access django in C ?
>>>
>>> Etienne
>>>
>>>
>>> Le 2018-01-23 à 04:32, Etienne Robillard a écrit :
>>>
>>>> Hi,
>>>>
>>>>
>>>> I would like to know if it would be possible to autogenerate C bindings
>>>> for the whole Django package in Cython or similar extension.
>>>>
>>>> What do you think? :)
>>>>
>>>> Cheers,
>>>>
>>>> Etienne
>>>>
>>>>
>>>>
>>> --
>>> Etienne Robillard
>>> tka...@yandex.com
>>> https://www.isotopesoftware.ca/
>>>
>>> --
>>> 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/ms
>>> gid/django-users/5b89eee2-b69e-f35b-4a8f-ac3bbb362cda%40yandex.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/b6a19d7d-940b-4855-ab74-96f0e30b75fd%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/b6a19d7d-940b-4855-ab74-96f0e30b75fd%40googlegroups.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/CAFWa6tLyLBJ3K8CG7KbxSeDY0K8BPz%2BH20V-LdX1uBEqOi_BJg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: PostrgreSQL Inside Virtualenv

2018-01-24 Thread Avraham Serour
In any case you'll need to pip install the postgres drivers for python, I
suggest doing that inside the env


On Wed, Jan 24, 2018 at 11:32 AM, tango ward  wrote:

> Got it. Thanks Anoosha
>
> On Wed, Jan 24, 2018 at 5:29 PM, 'Anoosha Masood Keen' via Django users <
> django-users@googlegroups.com> wrote:
>
>> Install it on your computer.
>>
>> On Wednesday, January 24, 2018 at 8:49:17 AM UTC, tangoward15 wrote:
>>
>>>
>>> Hi,
>>>
>>>
>>> Newbie question, since I installed django and pillow inside virtualenv,
>>> shall I also install PostgreSQL inside Virtualenv? At the moment I am still
>>> using SQLite in my pet project.
>>>
>>>
>>> Regards,
>>> Jarvis
>>>
>>>
>>> --
>> 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/ms
>> gid/django-users/962726a2-e3b3-4ee1-b81b-c1227656b7da%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/CAA6wQLKYD2z4dvuxESSp67CSiDDOttMJuGxizhFHyVRhA%2BHq6w%
> 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/CAFWa6tLjsVTidO1X4v8wB%2BBukYTjKMiif4_CLFjqsPW_3WdbDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to autoGenerate C bindings for Django 1.11 ?

2018-01-23 Thread Avraham Serour
Did you try doing this and see what happens?

On 23 Jan 2018 9:56 PM, "Etienne Robillard"  wrote:

> Can I create a file named libdjango.pyx with the following code:
>
> {{{
>
> import django
>
> from django import *
>
> }}}
>
> Then compile the C file with gcc to access django in C ?
>
> Etienne
>
>
> Le 2018-01-23 à 04:32, Etienne Robillard a écrit :
>
>> Hi,
>>
>>
>> I would like to know if it would be possible to autogenerate C bindings
>> for the whole Django package in Cython or similar extension.
>>
>> What do you think? :)
>>
>> Cheers,
>>
>> Etienne
>>
>>
>>
> --
> Etienne Robillard
> tkad...@yandex.com
> https://www.isotopesoftware.ca/
>
> --
> 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/ms
> gid/django-users/5b89eee2-b69e-f35b-4a8f-ac3bbb362cda%40yandex.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/CAFWa6tLY_TtaVPcwi9r916szoHDiLf5hphojNAK%2BnxqHR%3DQSeQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to get two django rest framework to communicate with each other

2018-01-16 Thread Avraham Serour
This shouldn't be a problem, I work with several people on the same django
app.
We use git to share the code. you can use a hosted git service like gitlab,
github or bitbucket


On Tue, Jan 16, 2018 at 9:58 AM,  wrote:

> Oh, but the thing is i am doing 1 project, and another person is doing
> other part of the project. And we have to integrate with each other. So we
> each have our own db.
>
> On Tuesday, January 16, 2018 at 2:34:01 PM UTC+9, Shree Kant Bohra wrote:
>>
>> You can use same database for both applications, so you don't have to
>> worry about the API and interacting with each other.
>>
>>
>> --
>> Shree Kant Bohra
>> Co-founder
>> Geekybuddha Technologies
>>
>>
>>
>>
>> On Tue, Jan 16, 2018 at 9:29 AM,  wrote:
>>
>>> Ok, maybe i'm confuse about this whole thing.
>>>
>>> So these are my task
>>> - Integration of django 1 api and django 2 api, to setup two django app,
>>> on same server / PC, with different port
>>> - Integration of django 1 api and django 2 api, to setup two django app,
>>> on same server / PC, with different database
>>> - Integration of django 1 api and django 2 api, on django api method on
>>> django 1 api, code to POST BookAppt
>>> - Integration of django 1 api and django 2 api, on django api method on
>>> django 2 apiI, code to GET BookAppt
>>> - Integration of django 1 api and django 2 api, on django api method,
>>> connect to another API
>>>
>>> May anyone please explain to me about connect to another api ? From my
>>> understanding, it is API connect to another API.Which allow django 1 api to
>>> POST to BookAppt and django 2 api to GET the data.
>>>
>>> On Monday, January 15, 2018 at 1:42:59 PM UTC+9, chern...@gmail.com
>>> wrote:

 So i have 2 django project. Both have its seperated database and table.
 I create the django rest framework api for both project but i want both of
 them to communicate with each other.


 In django 1 is about the social media and medical record app API. In
 django 2 is a clinic app API where the it is for staff of the clinic and
 collect user information from django 1 and to give a queue number for user
 that make appointment.


 What im trying to do is django 2 will have a qr code for django 1 to
 scan. After scanning, it will ask for permission to allow their information
 to be share with django 2(their user information/medical record). After
 user allow, their information will be save to django 2 database.

 For now, i just want to allow django 2 to save the user information
 from django 1.


 Is there a way for 2 different django project to communicate with each
 other through the api ?

>>> --
>>> 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/ms
>>> gid/django-users/c6589e9c-662c-4204-91ae-fe30ac2711f1%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/86b4df03-9d91-4d30-94b1-77590de5e5af%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/CAFWa6tJU6BCf4y0YO1iqtqdsjt%3DN1GKtggQ8MOQGUVowazATPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django test command with --parallel

2018-01-10 Thread Avraham Serour
does it work without the parallel flag?

On Wed, Jan 10, 2018 at 10:57 AM, Yevhen Yevhen  wrote:

> The same traceback from the pastebin link:
>
> Creating test database for alias 'default'...
> Cloning test database for alias 'default'...
> Cloning test database for alias 'default'...
> System check identified no issues (0 silenced).
> Traceback (most recent call last):
>   File "manage.py", line 41, in 
> main()
>   File "manage.py", line 37, in main
> execute_from_command_line(sys.argv)
>   File "/Users/me/.virtualenvs/project/lib/python3.6/site-
> packages/django/core/management/__init__.py", line 364, in
> execute_from_command_line
> utility.execute()
>   File "/Users/me/.virtualenvs/project/lib/python3.6/site-
> packages/django/core/management/__init__.py", line 356, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/Users/me/.virtualenvs/project/lib/python3.6/site-
> packages/django/core/management/commands/test.py", line 29, in
> run_from_argv
> super(Command, self).run_from_argv(argv)
>   File "/Users/me/.virtualenvs/project/lib/python3.6/site-
> packages/django/core/management/base.py", line 283, in run_from_argv
> self.execute(*args, **cmd_options)
>   File "/Users/me/.virtualenvs/project/lib/python3.6/site-
> packages/django/core/management/base.py", line 330, in execute
> output = self.handle(*args, **options)
>   File "/Users/me/.virtualenvs/project/lib/python3.6/site-
> packages/django/core/management/commands/test.py", line 62, in handle
> failures = test_runner.run_tests(test_labels)
>   File "/Users/me/.virtualenvs/project/lib/python3.6/site-
> packages/django/test/runner.py", line 603, in run_tests
> result = self.run_suite(suite)
>   File "/Users/me/.virtualenvs/project/lib/python3.6/site-
> packages/django/test/runner.py", line 567, in run_suite
> return runner.run(suite)
>   File "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/unittest/runner.py",
> line 176, in run
> test(result)
>   File "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/unittest/suite.py",
> line 84, in __call__
> return self.run(*args, **kwds)
>   File "/Users/me/.virtualenvs/project/lib/python3.6/site-
> packages/django/test/runner.py", line 370, in run
> subsuite_index, events = test_results.next(timeout=0.1)
>   File 
> "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/multiprocessing/pool.py",
> line 735, in next
> raise value
>   File 
> "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/multiprocessing/pool.py",
> line 424, in _handle_tasks
> put(task)
>   File "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/
> multiprocessing/connection.py", line 206, in send
> self._send_bytes(_ForkingPickler.dumps(obj))
>   File 
> "/Users/me/.pyenv/versions/3.6.2/lib/python3.6/multiprocessing/reduction.py",
> line 51, in dumps
> cls(buf, protocol).dump(obj)
> _pickle.PicklingError: Can't pickle  0x1093db730>: it's not the same object as unittest.case.TestCase.run
>
>
>
> On Tuesday, January 9, 2018 at 7:22:50 PM UTC+2, Yevhen Yevhen wrote:
>>
>> I try to run my django tests using --parallel flag but get the following 
>> error
>> (pastebin) . How can I fix this?
>>
>> --
> 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/3da47ff2-3ab4-40e9-becc-8c06362b1739%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/CAFWa6tKUyh4X5wvLvL66pJWPDUML2sg8zemvE%2Be3-O-UiVc%3DgQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django storing byte string for image

2018-01-03 Thread Avraham Serour
I used this project once:
http://django-db-file-storage.readthedocs.io/en/latest/

It seems it uses a TextField for the file bytes.

I would expect django.contrib.postgres to implement a binary field, but it
don't.

I guess you can implement your own field type for bytea, psycopg maps bytes
to bytea:
http://initd.org/psycopg/docs/usage.html#adaptation-of-python-values-to-sql-types

In any case I recommend to give this a second thought, the DB is not so
efficient to store and serve files as the filesystem is.

On Wed, Jan 3, 2018 at 2:19 PM, Jani Tiainen  wrote:

> Hi,
>
> In general it is considered very bad practice to store files in database.
>
> Could you please tell why you need to store files to database instead of
> normal filesystem?
>
> 3.1.2018 14.03  kirjoitti:
>
>> What field should i use to store byte string so that i can later use it
>> for ByteIO to convert it into image ?
>>
>> As this is my first time doing on byte string to image, i am pretty lost
>> on what i need to do.
>>
>> I tried using BinaryField for the image model but when checking the field
>> out on Django admin, it gave me this error
>> 'image' cannot be specified for MyUser model form as it is a non-editable
>> field
>> i also tried setting BinaryField(editable=True) but it still doesnt work.
>>
>> May i have some guidance on how to store the byte string ?
>>
>> --
>> 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/ms
>> gid/django-users/2f787ba8-6c74-4feb-bbdf-f5473acdc835%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/CAHn91odTJHuY%3D71JkTPuX3cV5AsOou-YfqNBf_
> wybfC5yh_dcQ%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/CAFWa6tKcFf5uZuF%3D7zUyFSo9oOzsBh1VQGZ6-8W4pv_Ti%2B-sjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Wich OS for develop?

2018-01-02 Thread Avraham Serour
In my opinion ubuntu
no, but I wouldn't say good either
yes
pycharm
good luck

On Tue, Jan 2, 2018 at 11:23 PM, Julián Melero Hidalgo <
jul...@melerohidalgo.es> wrote:

> Hi all.
> I don't have experience with django, so I have so much questions.
> The questions are:
> Wich OS is better to develop with django?
> Windows is a bad option?
> Can I use Win for develop and GNU/Linux as a server?
> What IDE (atom, VS Code, vim,etc..)you use?
> Thank you!!!
>
> --
> 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/2be2cccf-461a-40f7-a7d6-0ba65c1c5acd%
> 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/CAFWa6tLdWo6iRgXO0kcgwtkNtV0tF03DY-ZJMm2pbuaM%3Dwabug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: DRF JWT Token with Mobile

2017-12-29 Thread Avraham Serour
instead of:
curl -X POST -d "mobile=1234567890" http://localhost:8000/api-token-auth/

could you just use:
curl -X POST -d "username=1234567890" http://localhost:8000/api-token-auth/

In any case what's the use case here? This doesn't seem secure at all, to
log in someone only using the username, even more using a public know
information

On Fri, Dec 29, 2017 at 8:21 AM, Andréas Kühne 
wrote:

> Hi,
>
> You will have to implement your own authentication backend to make that
> work.
>
> See here for an example:
> https://chrisbartos.com/articles/how-to-implement-
> custom-authentication-with-django-rest-framework/
>
> Regards,
>
> Andréas
>
> 2017-12-29 5:25 GMT+01:00 Mukul Mantosh :
>
>> Django Rest Framework JWT (http://getblimp.github.io/dja
>> ngo-rest-framework-jwt/) as specified that JWT token can be obtained by
>> passing username and password.
>>
>> Example:
>> $ curl -X POST -d "username=admin=password123" http://localhost:
>> 8000/api-token-auth/
>>
>> How to obtain the JWT Token using only mobile number.
>> $ curl -X POST -d "mobile=1234567890" http://localhost:8000/api-toke
>> n-auth/
>>
>> Normally JWT works with the combination of username and password but i
>> want the token using the mobile number only.
>>
>>
>> On Thursday, December 28, 2017 at 6:22:07 PM UTC+5:30, Krishnasagar
>> Subhedarpage wrote:
>>>
>>> Can you elaborate question? Please add some background for it.
>>> ---
>>> Krishnasagar
>>>
>>>
>>>
>>> On Thu, Dec 28, 2017 at 1:40 PM, Mukul Mantosh 
>>> wrote:
>>>
 How to get JWT Token in DRF using only mobile number as the parameter
 instead of email and password..

 --
 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/ms
 gid/django-users/1b3ae8bb-2039-4aa9-8a9f-2c4ddb2ffc55%40goog
 legroups.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/ms
>> gid/django-users/b0d5e227-7488-4c86-b757-681c287a1558%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/CAK4qSCc1g6LP0dC%3DSAUzOD17A5dEkTYtTHM96EP6rgNS
> 3XerUA%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/CAFWa6t%2BLqAiRZ83osVUHqVQdcZ0-aqF8%2B94X8j3omep7Mwpy0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: DJANGO NOT FOUND

2017-12-24 Thread Avraham Serour
did you create a virtualenv for the project? you shouldn't pip install
stuff in the system python.

can you import django using the python console?

On Sun, Dec 24, 2017 at 2:22 AM, Jack 
wrote:

> Hi, i've installed on my ubuntu 16.04 LTS python3.6 and django but django i
> have installed with pip3 and usign virtualenv, but it is ok by console, the
> problem is in eclipse, i installed python, it is OK, but at the moment of
> creating a django project, it drops a message, django not found, i've
> removed the interpreter and add it again because i thought it was the
> problem but the problem continues, i've uninstalled pydev from eclipse and
> the problem is the same.
>
> If someone knows about this, please help me.
>
> Thnks a lot.
>
> --
> 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/58251deb-dc26-4f68-8a1b-c838f0f97e43%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/CAFWa6tK0Ev9jCqT2h%3Dd5K4QocPUjx4MvnNiNwQDQ9ZyAkdv5gg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ORM Foreign Keys][Performance] How to use Charfield Foreign Keys efficiently?

2017-11-21 Thread Avraham Serour
can you post your model?

On Tue, Nov 21, 2017 at 3:31 PM, Dominik Szmaj 
wrote:

> Hey,
>
> I have a very big performance problem with Django and Oracle db.
>
> This legacy db has lots of primary keys as strings from the time when
> those id's were alphanumerical so it can't be simply converted to number.
>
> So when I set FK on such varchar column django seems to not crash but it
> converts to int and search whole table of strings with a number which takes
> ages to complete.
>
> Is there maybe some sane solution to the problem? Why it forces me to use
> numbers on varchar FK?
>
> Best regards.
> Dominik
>
> --
> 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/e4e51608-740c-410c-bc47-21d189c0edf6%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/CAFWa6tKd-c9bUn5qSv9hFQvPSvVVyqOi1GpOWYQWz2uzL52h%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Url with optional arguments

2017-11-08 Thread Avraham Serour
I recommend putting two entries on urls.py, they can both point to the same
view.
Just be sure to set a default value for subpage_slug on the function
argument

On Wed, Nov 8, 2017 at 3:01 PM,  wrote:

> Hi everyone,
>
> I would like to make a documentation app with urls like this (not
> flatpages) :
>
> [server]/docs// ==> go to product main help page
>
> [server]/docs/// ==> go to product sub help
> page.
>
> How can i write this in app urls.py ?
>
> 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/3d4f0a0d-dc46-488a-9aec-a97120518e64%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/CAFWa6tK_vXmd9Epkif%3DC3%2BWvpFs-WAzoEAmpePHe%3DUB276zD7A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: OSError: [Errno 13] Permission denied:... /_dummy_thread

2017-11-06 Thread Avraham Serour
don't use sudo to pip install packages, you should create a virtualenv for
your project

On Mon, Nov 6, 2017 at 8:24 AM, Vineet Kothari 
wrote:

> try to update your python : https://stackoverflow.com/
> questions/2720014/upgrading-all-packages-with-pip
>
> On Mon, Nov 6, 2017 at 12:10 AM, Mel DeJesus 
> wrote:
>
>> Do that only leads to another permission denied error -
>>
>> Installing collected packages: argparse, configparser, konfig, pyzmq,
>> inflect, jaraco.itertools, tempora, jaraco.stream, jaraco.classes,
>> backports.functools-lru-cache, jaraco.functools, jaraco.text,
>> jaraco.collections, jaraco.logging, irc, webob, WSGIProxy2, greenlet,
>> gevent, psutil, waitress, beautifulsoup4, webtest, ws4py, ujson, loads
>> Exception:
>> Traceback (most recent call last):
>>   File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215,
>> in main
>> status = self.run(options, args)
>>   File "/Library/Python/2.7/site-packages/pip/commands/install.py", line
>> 342, in run
>> prefix=options.prefix_path,
>>   File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 784,
>> in install
>> **kwargs
>>   File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line
>> 851, in install
>> self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
>>   File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line
>> 1064, in move_wheel_files
>> isolated=self.isolated,
>>   File "/Library/Python/2.7/site-packages/pip/wheel.py", line 377, in
>> move_wheel_files
>> clobber(source, dest, False, fixer=fixer, filter=filter)
>>   File "/Library/Python/2.7/site-packages/pip/wheel.py", line 287, in
>> clobber
>> ensure_dir(dest)  # common for the 'include' path
>>   File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line
>> 83, in ensure_dir
>> os.makedirs(path)
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py",
>> line 157, in makedirs
>> mkdir(name, mode)
>> OSError: [Errno 1] Operation not permitted: '/System/Library/Frameworks/Py
>> thon.framework/Versions/2.7/include/python2.7/greenlet'
>>
>>
>> On Sunday, November 5, 2017 at 1:36:18 PM UTC-5, Mel DeJesus wrote:
>>>
>>> as in:
>>> sudo pip install -r requirements.txt
>>> ?
>>>
>>> On Sunday, November 5, 2017 at 1:33:07 PM UTC-5, me.vineetkothari wrote:

 Use sudo

 On Nov 6, 2017 12:00 AM, "Mel DeJesus"  wrote:



 Any suggestions? -->

 After attempting pip install -r requirements.txt in a virtual
 environment, I got a number of files loaded before getting this:


 Exception:
 Traceback (most recent call last):
   File "/Library/Python/2.7/site-packages/pip/basecommand.py", line
 215, in main
 status = self.run(options, args)
   File "/Library/Python/2.7/site-packages/pip/commands/install.py",
 line 342, in run
 prefix=options.prefix_path,
   File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line
 784, in install
 **kwargs
   File "/Library/Python/2.7/site-packages/pip/req/req_install.py",
 line 851, in install
 self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
   File "/Library/Python/2.7/site-packages/pip/req/req_install.py",
 line 1064, in move_wheel_files
 isolated=self.isolated,
   File "/Library/Python/2.7/site-packages/pip/wheel.py", line 345, in
 move_wheel_files
 clobber(source, lib_dir, True)
   File "/Library/Python/2.7/site-packages/pip/wheel.py", line 316, in
 clobber
 ensure_dir(destdir)
   File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line
 83, in ensure_dir
 os.makedirs(path)
   File 
 "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py",
 line 157, in makedirs
 mkdir(name, mode)
 OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-pack
 ages/_dummy_thread

 --
 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/ms
 gid/django-users/14fac784-dfdb-481b-b6bc-bf03f8499871%40goog
 legroups.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 

Re: Generating a unique 10 digit ID for each model instance

2017-10-22 Thread Avraham Serour
The database usually handles this and you don't need to worry, there are
many corner cases and DB systems are able to handle them

But they won't look like whatever format you would like, usually it is just
a number

Why do you need the IDs to look like that?

On Oct 22, 2017 6:53 PM, "Jack Zhang"  wrote:

> Let's say I have a model called 'Dogs'.  Users can create instances of
> Dogs.  For every Dogs instance that is created, I want to assign a globally
> unique ID to it.  The ID will be 3 capitalized letters followed by 7
> numbers.  E.g. ABC1234567, POZ2930193
>
> What is the easiest way to go about doing this?  I looked into UUID but it
> generates a longer string.  Keep in mind that the ID must be globally
> unique - so after one has been created, it should not be created again.
>
> 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/0cd8e33c-8c92-471c-9c36-ac82749750b4%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/CAFWa6t%2B6p-zRLv1Op_ipmZvi1M1HAeEx%2B5ZMR_BN78kGBi%3DuCQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Big data

2017-09-29 Thread Avraham Serour
That doesn't sound that big.
Maybe you can tune mysql, but I have worked with postgres handling more
than that, it works fine without tuning, I changed a couple of settings
(like work_mem) and improved

On Fri, Sep 29, 2017 at 4:48 AM, Larry Martell 
wrote:

> I am taking about using hbase as a db for Django. My use case is that a
> have a Django app and the data in mysql has grown to the point where
> performance has greatly suffered.
>
> We have around 2TB of data with some very wide tables with many millions
> of rows. So I am beginning my research into how to improve performance.
>
> On Thu, Sep 28, 2017 at 9:41 PM Vivek Shrivastava <
> vivshrivast...@gmail.com> wrote:
>
>> Are you asking HBase as database for Django or accessing HBase from
>> Django? The popular framework Hue http://gethue.com/ is based on Django
>> only..
>>
>> On Thu, Sep 28, 2017 at 9:34 PM, Larry Martell 
>> wrote:
>>
>>> Has anyone ever used any big data solutions, such as hbase, with django?
>>>
>> --
> 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/CACwCsY6DG2LZ_0zh2obL6Mf0NBAOa1jBN9q1DmAagRB
> S195nZA%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/CAFWa6tKG_JNecFrW6eDXGTn_Xmow8eeFf4vwJ%2BOR-xWQB8Ruqg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: submit form as superuser vs regular user

2017-09-19 Thread Avraham Serour
not sure if related, but the docs suggest to inherit from AbstractUser, not
User

https://docs.djangoproject.com/en/1.11/topics/auth/customizing/


On Mon, Sep 18, 2017 at 12:58 PM, Danae Vogiatzi 
wrote:

> In my django app I have a Myuser(User) class. It inherits the User class.
> When a new user is created the Myuser table is poplulated.
>
> myusers.py
>
> class Myuser(User):
> address = models.CharField(max_length=40)
> pobox = models.CharField(max_length=40)
>
> models.py
>
> class Someclass(models.Model):
> objectid= models.IntegerField()
> objecttype  =  models.CharField(max_length=200)
> created =  models.DateTimeField(default=timezone.now)
> modified=  models.DateTimeField(auto_now=True)
> class Someotherclass(Someclass):
> status = models.IntegerField(default=0,)
> name   =  models.CharField(max_length=200)
>   created =  models.DateTimeField(default=timezone.now)
> modified =  models.DateTimeField(auto_now=True)
>   user = models.ForeignKey(User)
>
> forms.py
>
> class SomeotherclassForm(forms.ModelForm):
>
> def __init__(self, *args, **kwargs):
> self.request = kwargs.pop("request")
> self.user = kwargs.pop('user')
> self.app = kwargs.pop('app')
> self.table = kwargs.pop('table')
> self.mytype = kwargs.pop('mytype')
> initial = kwargs.get('initial', {})
> super(SomeotherclassForm, self).__init__(*args, **kwargs)
>
> create.py
>
> class  DataCreate(CreateView):
>   @method_decorator(login_required)
>   def dispatch(self, *args, **kwargs):
>  #some code here not relevant at all
>
>   def get_form_kwargs(self):
> kwargs = super(DataCreate, self).get_form_kwargs()
> objectid = self.request.GET.get('objectid',None)
> objecttype = self.request.GET.get('objecttype',None)
> kwargs.update({'mytype': objecttype})
> kwargs.update({'request': self.request})
> kwargs.update({'user': self.request.user})
> kwargs.update({'app': self.app})
> kwargs.update({'table': self.kwargs['table'].lower()})
> return kwargs
>
>   def form_valid(self, form):
> obj = form.save(commit=False)
> group = ''
> if not self.request.user.is_superuser:
> group = MyUser.objects.get(user_ptr_id=self.request.user.pk)
> else:
> groups = self.request.user.groups.all()
> if  self.kwargs['table'] == 'Myprotocol':
> obj = form.save(commit=False)
> table = 
> eval(self.request.GET.get('objecttype',None).title()).objects.get(pk=int(self.request.GET.get('objectid',None)))
>
> obj.objectid = table.pk
> obj.objecttype = table.__class__.__name__.lower()
> obj.user_id = self.request.user.pk
> obj.save()
> else:
> obj = form.save()
> if self.request.POST.get('is_popup'):
> check = int(self.kwargs['is_list'])
> if self.kwargs['table'] == 'Someclass':
> popup = 1
> a = checkPopup2(obj,check,popup,obj.pk)
> else:
> a = checkPopup(obj,check)
>
> return a
> else:
> return super(DataCreate, self).form_valid(form)
>
>
> When I have logged in as a regular user ,everything works fine. When I log
> in as a superuser, I get form error that objecttype,objectid and user are
> not filled. In my attempts to troubleshoot it , I realized that when I am
> logged in as a superuser ,it dowsn't reach the form_valid() function. I
> can't figure out why that is happening. Any suggestions or advice on how to
> troubleshoot it?
>
> --
> 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/570196c4-7fd8-45ec-a33f-0713f0639228%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/CAFWa6tKycjrHL5bOvE2H1wCvsXymO4zCDqCnAJknNOEKcyQV-Q%40mail.gmail.com.
For more options, 

Re: Install uWSGI on cygwin

2017-09-13 Thread Avraham Serour
try using pip: 'pip install uwsgi'


On Wed, Sep 13, 2017 at 11:35 AM, Dick Pan  wrote:

> Hi,
>
> When I install uWSGI on cygwin by command: python2.7 uwsgiconfig.py
> --build
>
> one strange problem occur, undefined reference to `uuid_generate' on
> cygwin.
> but uuid.h exist in /usr/include/uuid/, and I checked GCC include path by
> command: echo | gcc -v -x c++ -E -, it's ok.
>
> At last, I have to update core/uitls.c
>
> change function uwsgi_uuid to following:
>
> void uwsgi_uuid(char *buf) {
> *#ifdef UWSGI_UUID*
> *#undef UWSGI_UUID*
> *#endif*
>
> can you help me to fix this problem in elegant methods?
>
> 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/018f927b-66b4-4e48-b5bb-a40faac69082%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/CAFWa6tLQ3ka_MWu0Fm7HFuCMr72khoOUsE91LGQtfRKrOBuoRg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: regarding virtualenv and python version 3.5 or 3.4 or other versions

2017-08-16 Thread Avraham Serour
on the same link it is mentioned "To not touch the system Python (generally
a bad idea..."

it is suggested to use pyenv, you may use instead pythonz

On Wed, Aug 16, 2017 at 3:56 AM, Seo Brain <seob...@gmail.com> wrote:

> Hi Avraham
>
> Thanks.
>
> I did install the python V3.6 on my dev-server ubuntu 14.04
>
> by using this
> https://askubuntu.com/questions/865554/how-do-i-
> install-python-3-6-using-apt-get
>
> //also map 3.6.2 to python3 folder by this way
> sudo rm python3
> sudo ln -s python3.5 python3
>
> python -V shows v3.6.2
> sudo apt-get install python3.6-venv -- able to install virtualenv
>
> and python -V is v2.7 and python3 -V is v3.6.2
>
> which python3 -- (/usr/bin/python3)
>
> which pip3 (/usr/local/bin/pip3) or pip (/usr/local/bin/pip) display the
> path
>
> and issue is pip -V or pip3 -V , error display
>
> 
> Traceback (most recent call last):
>   File "/usr/local/bin/pip3", line 7, in 
> from pip import main
>   File "/usr/lib/python3/dist-packages/pip/__init__.py", line 59, in
> 
> from pip.log import logger
>   File "/usr/lib/python3/dist-packages/pip/log.py", line 9, in 
> import colorama, pkg_resources
>   File "", line 961, in _find_and_load
>   File "", line 950, in
> _find_and_load_unlocked
>   File "", line 646, in _load_unlocked
>   File "", line 616, in
> _load_backward_compatible
>   File 
> "/usr/share/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py",
> line 1479, in 
> register_loader_type(importlib_bootstrap.SourceFileLoader,
> DefaultProvider)
> AttributeError: module 'importlib._bootstrap' has no attribute
> 'SourceFileLoader'
> ---
>
>
> and i tried to upgrade the pip3 and still the same error.
>
> Please help to figure it out.
>
> Thanks
>
> Ross
>
>
>
> On Sunday, August 13, 2017 at 8:11:57 AM UTC-7, Avraham Serour wrote:
>>
>> I suggest using 3.6, which is the current stable release
>> if your machine or the server doesn't have this version installed you may
>> compile it yourself and create the virtualenv for the project from there
>>
>> There are some projects that help you with that, I like pythonz
>> https://github.com/saghul/pythonz
>>
>>
>> On Sun, Aug 13, 2017 at 9:33 AM, Seo Brain <seo...@gmail.com> wrote:
>>
>>> Hi, the question is about which python version suppose to use. On web
>>> server is ubuntu 14.4 - python v3.4 (i assume) with virtualenv, my local is
>>> python v3.5 or may be using v3.4 if i have to keep the same version on web
>>> server ? v3.4 seems has issue to install on one of my windows 7, but no
>>> issue on mac. or may be i suppose to use virtual-box to keep the
>>> environment same everywhere dev and production server ?
>>> thanks in advance. Ross
>>>
>>> --
>>> 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/ms
>>> gid/django-users/7937063c-e3cb-44b7-b524-097b82d05d87%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/7937063c-e3cb-44b7-b524-097b82d05d87%40googlegroups.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/82d094db-0338-495b-963e-c912cf068171%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/82d094db-0338-495b-963e-c912cf068171%40googlegroups.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/CAFWa6t%2B7HDffpaHxs%3DFvVU8z4sCJm7-dWZvqYRdFoEqd9jGXoA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: regarding virtualenv and python version 3.5 or 3.4 or other versions

2017-08-13 Thread Avraham Serour
I suggest using 3.6, which is the current stable release
if your machine or the server doesn't have this version installed you may
compile it yourself and create the virtualenv for the project from there

There are some projects that help you with that, I like pythonz
https://github.com/saghul/pythonz


On Sun, Aug 13, 2017 at 9:33 AM, Seo Brain  wrote:

> Hi, the question is about which python version suppose to use. On web
> server is ubuntu 14.4 - python v3.4 (i assume) with virtualenv, my local is
> python v3.5 or may be using v3.4 if i have to keep the same version on web
> server ? v3.4 seems has issue to install on one of my windows 7, but no
> issue on mac. or may be i suppose to use virtual-box to keep the
> environment same everywhere dev and production server ?
> thanks in advance. Ross
>
> --
> 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/7937063c-e3cb-44b7-b524-097b82d05d87%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/CAFWa6tJi0OTi9sQbd23AxSuXZ12b6-YtNFp8J-q%2BuP_aPhji4w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: deploying on windows

2017-08-12 Thread Avraham Serour
I had to deploy django on windows once, after trying some different options
I ended up installing cygwin and compiling uwsgi and nginx inside cygwin.
Bonus you can use the same scripts to manage, you can ssh to the machine
and run bash

You could also try WSL, which is the same as cygwin but new (and official)

On Sat, Aug 12, 2017 at 9:17 PM, Larry Martell 
wrote:

> I have experience with apache (not on windows), but none at all with
> IIS. Don't think I want to go down that route.
>
> On Sat, Aug 12, 2017 at 2:15 PM, Jani Tiainen  wrote:
> > Certain version of IIS does have native WSGI support.
> >
> > Couldn't find it with my phone but google should help you with that.
> >
> > 12.8.2017 21.06 "Larry Martell"  kirjoitti:
> >>
> >> I have a django app that runs in linux. It uses nginx and uwsgi. I
> >> have successfully deployed it with Docker, vagrant/VirtualBox, VMware,
> >> kvm, and on bare metal. But now I have prospective client that refuses
> >> to run linux, even in a VM. So I am tying to get my app running on
> >> Windows Server 2016, piece by painful piece.
> >>
> >> From what I have read nginx and uwsgi cannot be used on Windows. Is
> >> that indeed true? Is my only option apache and mod_wsgi?
>
> --
> 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/CACwCsY6Tbf61iJa4YtYoLkvB0f33o
> -JQV2-wGhGMZu8wVUN2tg%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/CAFWa6t%2BH0uRN6RLFe7yoOBToR-z66ev7Piy8GLTYc6nooTPXpA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multiple DB - Accessing another app's table/model?

2017-07-18 Thread Avraham Serour
import the Model and query it.

from appB.models import Table
Table.objects.all()


On Tue, Jul 18, 2017 at 6:01 PM, miguel vfx  wrote:

> Hello,
>
> After following through the documentation, I was able to query data from
> another database. However, I was only able to access the table of the same
> app name. How can I query data from a different app name?
>
> For example:
> appA has a model client_data. It's table name in the app_db database is
> appA_client_data.
>
> In appB, I created the same model then when I query the data from appA, I
> get zero results because it's querying data from appB_client_data in
> appA_db.
>
> How do I query client_data table/model of appA_db from appB (Both are on
> different projects)
>
> Thank you for your time.
>
> --
> 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/d7e05187-a93d-4b81-88f6-caeb652780b4%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/CAFWa6t%2BZoPq_L6aPRG%3D69st80jAA8gu94JiTTc0rmgn3TEav_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What Way is best to extend User in Django 1.11?

2017-07-18 Thread Avraham Serour
I suggest creating a profile, leave the auth.User only for auth, all else
specific to you application use your own model and reference to that


On Tue, Jul 18, 2017 at 9:48 AM, 李余通  wrote:

> How to extend User?I find many ways;
> 1. Use Profile
> eg:
>
> class UserProfile(models.Model):
> user = models.OneToOneField(User)
> major = models.TextField(default='', blank=True)
>
> This way is easy to understand,However,it will create a new table in sql,I 
> heard this will add System burden.
>
> 2.inherit User
> eg:class CustomUser(User):
> timezone = models.CharField(max_length=50, default='Asia/shanghai')
> objects = UserManager()
>
> This way seems also will add a new table.
>
> There also have some way but i don't understand,so I want know on Django 
> 1.11,What way is best to extend User?
>
> --
> 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/ee6c8e4a-5f0a-4d20-9855-6c4af4792ff8%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/CAFWa6tLyNh%3DHdYzkrqXYKHgFTbPYwW9ma3qQ6qAP9oKrZESfSw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Use one correspondig database user for each application user

2017-07-11 Thread Avraham Serour
Where would you store the password hashes?

This would mean that no data ever could have relations between users

On Tue, Jul 11, 2017 at 12:40 PM, guettli  wrote:

> I guess most applications have exactly one database user.
>
> Why not use one database for each application user?
>
> Example: User "foo" in my web application has a corresponding database
> user "foo".
>
> This way you could use row level security from the database.
>
> PostgreSQL has a lot of interesting features: https://www.postgresql.org/
> docs/devel/static/ddl-rowsecurity.html
>
> Use case: Show me all items which user "foo" is allowed to see.
>
> --
> 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/7d1eaa8c-d80a-4390-aaf9-8a95d3fcf6b4%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/CAFWa6t%2BM1VZkKp1wky%2BN42y-vW0vWMtod64zcm7%2BfzGPP%2B4a-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-oscar ModuleNotFoundError 'apps\\checkout'

2017-07-06 Thread Avraham Serour
what is the cwd?

On Thu, Jul 6, 2017 at 6:55 PM, Bernard Oosthuizen <
bernardoosth...@gmail.com> wrote:

> Here is my tree view. I think I might as well just work on linux because I
> am struggling a lot with packages on Windows.
>
> ├───apps
> │   ├───checkout
> │   │   └───__pycache__
> │   ├───order
> │   │   ├───migrations
> │   │   │   └───__pycache__
> │   │   └───__pycache__
> │   └───__pycache__
> ├───frobshop
> │   ├───settings
> │   │   └───__pycache__
> │   ├───static
> │   ├───templates
> │   │   ├───checkout
> │   │   └───frobshop
> │   └───__pycache__
> └───requirements
>
> On Thursday, July 6, 2017 at 10:03:04 AM UTC+2, Avraham Serour wrote:
>>
>> The double backslash is probably because you are on Windows
>>
>> Can you post your directory structure?
>>
>> You may try printing the cwd on settings.py to see what the relative path
>> should be
>>
>> On Jul 5, 2017 9:10 PM, "Bernard Oosthuizen" <bernard...@gmail.com>
>> wrote:
>>
>>> I am trying to *fork* one of the apps of django-oscar so that I can
>>> customize it. I followed all the instructions on django-oscar docs
>>> <https://django-oscar.readthedocs.io/en/latest/topics/customisation.html#fork-oscar-app>
>>>
>>> All the files are created when I run
>>>
>>>   python manage.py oscar_fork_app checkout apps/
>>>
>>>
>>> Then I add this to my *settings*.
>>>
>>> INSTALLED_APPS = INSTALLED_APPS + get_core_apps(['apps.checkout'])
>>>
>>>
>>> But then I get the following error:
>>>
>>> *ModuleNotFoundError: No module named 'apps\\checkout'*
>>>
>>>
>>> I don't know why it adds the *double backslash* in there. I have tried
>>> setting it like this as well:
>>>
>>> INSTALLED_APPS = INSTALLED_APPS + get_core_apps(['apps\checkout'])
>>>
>>>
>>> Same error.
>>>
>>> I have also forked the app in different directories but still the same
>>> error.
>>> Any suggestions?
>>> Django version *1.10.7*
>>>
>>> --
>>> 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/ms
>>> gid/django-users/b23071c8-fe55-41d6-928a-979617c4990b%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/b23071c8-fe55-41d6-928a-979617c4990b%40googlegroups.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/5dc8143a-c5eb-4bab-b77e-8d7989d2bf16%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/5dc8143a-c5eb-4bab-b77e-8d7989d2bf16%40googlegroups.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/CAFWa6t%2Bc-hCNJ%3DJtZP46uLhhmWP8KLCG5AMRws9PqTnVkgWtMA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-oscar ModuleNotFoundError 'apps\\checkout'

2017-07-06 Thread Avraham Serour
The double backslash is probably because you are on Windows

Can you post your directory structure?

You may try printing the cwd on settings.py to see what the relative path
should be

On Jul 5, 2017 9:10 PM, "Bernard Oosthuizen" 
wrote:

> I am trying to *fork* one of the apps of django-oscar so that I can
> customize it. I followed all the instructions on django-oscar docs
> 
>
> All the files are created when I run
>
>   python manage.py oscar_fork_app checkout apps/
>
>
> Then I add this to my *settings*.
>
> INSTALLED_APPS = INSTALLED_APPS + get_core_apps(['apps.checkout'])
>
>
> But then I get the following error:
>
> *ModuleNotFoundError: No module named 'apps\\checkout'*
>
>
> I don't know why it adds the *double backslash* in there. I have tried
> setting it like this as well:
>
> INSTALLED_APPS = INSTALLED_APPS + get_core_apps(['apps\checkout'])
>
>
> Same error.
>
> I have also forked the app in different directories but still the same
> error.
> Any suggestions?
> Django version *1.10.7*
>
> --
> 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/b23071c8-fe55-41d6-928a-979617c4990b%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/CAFWa6tKUbA59Sos4RCtg1LRgxkOJgAzhuDq3nqK%3DRrsRNuEAgg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deprecating model field (Deleting model field, but keeping DB column)

2017-07-05 Thread Avraham Serour
>From what you are describing it seems that you are planning for the long
term. which I don't believe is ideal
You may mark the whole model as not managed, but I don't think you can mark
just one field and unmanaged.

Another simple approach would be to transform the attribute to a property
and print deprecation warnings or raise an exception whenever someone tries
to write to it (or read)

I hope that if you have tests it will be enough to remove all use of the
deprecated field

Is that temporary? That would influence the approach
>From what I understood from your original post this is just a matter of
deploying the new app version that removes a field, so you would just need
to run migrations after deploying


On Wed, Jul 5, 2017 at 3:18 PM, Jani Tiainen <rede...@gmail.com> wrote:

> Hi,
>
> Sounds like your all developers do use same database if you have such a
> problems.
>
> It's usually good practice to have per developer development database.
> That will allow individual developers to do changes to database and migrate
> others as they please. Also it doesn't "matter" if one developer breaks
> their database for example by accidentally running migrations that are not
> in the repo yet.
>
> Of course, it requires that you have either database creation script, or
> like we do, we clone our staging database for development basis.
>
> On 05.07.2017 15:09, tay...@cedar.com wrote:
>
> Thanks for responding Avraham.
>
> That would be a good option if I was developing by myself, but I am
> working with a team of 20 developers. The process needs to be the same
> whether there are deprecated fields or not. I can't realistically expect 20
> people to not apply one migration (or a few specific ones). There may be
> other migrations after the deprecation that need to be applied, so it's
> very difficult to apply certain ones and ignore others. It would be
> similarly difficult to get everyone to apply one of the migrations with
> --fake, but do a different process with every other migration. Also, --fake
> applies to the entire migration (not just specific operations), so people
> would be forced to make separate migrations for other model changes and
> hopefully remember not to run --fake on those.
>
> My current best attempt was to create a custom DB migration operation
> https://docs.djangoproject.com/en/1.11/ref/migration-operations/#writing-
> your-own , that removes the field in state_forwards, but doesn't do
> anything to the db in database_forwards. That works, but the person that
> deprecates the field need to remember to change the RemoveField operation
> into the custom DeprecateField operation. It would be great if
> makemigrations created the correct operations automatically. Is there a way
> to do that?
>
> On Wednesday, July 5, 2017 at 7:27:22 AM UTC-4, Avraham Serour wrote:
>>
>> you can remove the field and don't run migrations until you are ready to
>> actually remove the column, or you may run migrations fake and leave the
>> column there forever
>>
>> https://docs.djangoproject.com/en/1.11/ref/django-admin/#cmd
>> option-migrate-fake
>>
>> On Wed, Jul 5, 2017 at 6:39 AM, <tay...@cedar.com> wrote:
>>
>>> I am having some trouble figuring out the best way to remove model
>>> fields in Django. If I remove a field from a model and then run
>>> makemigrations, it creates a RemoveField operation in a migration. That is
>>> great, but if I decide to run the migration before releasing the new code,
>>> the existing code will break (for a short time between running the
>>> migration and releasing the new code) because the old code is still
>>> querying for the removed column (Django queries for all columns by
>>> default). I could run the migration after the release, but that won't work
>>> if I also have an AddField operation because the new code needs the new
>>> column, so it needs to be run before. I am wondering if anyone has solved
>>> this issue?
>>>
>>> My best solution (I don't think Django supports this) would be to have a
>>> special type of field called a DeprecatedField. It would delete the field
>>> from Django's perspective, but keep the column in the DB. Django would no
>>> longer query for the column, but the column would still be in the DB. On
>>> the next release, I could remove the column completely (with a RemoveField
>>> operation) and the existing code would not error because it has no
>>> knowledge of the column.
>>>
>>> I noticed Django has an idea of a private field, which is on a model but
>>> not in the DB. Is there a way to create a field that is in the DB, but

Re: Deprecating model field (Deleting model field, but keeping DB column)

2017-07-05 Thread Avraham Serour
you can remove the field and don't run migrations until you are ready to
actually remove the column, or you may run migrations fake and leave the
column there forever

https://docs.djangoproject.com/en/1.11/ref/django-admin/#cmdoption-migrate-fake

On Wed, Jul 5, 2017 at 6:39 AM,  wrote:

> I am having some trouble figuring out the best way to remove model fields
> in Django. If I remove a field from a model and then run makemigrations, it
> creates a RemoveField operation in a migration. That is great, but if I
> decide to run the migration before releasing the new code, the existing
> code will break (for a short time between running the migration and
> releasing the new code) because the old code is still querying for the
> removed column (Django queries for all columns by default). I could run the
> migration after the release, but that won't work if I also have an AddField
> operation because the new code needs the new column, so it needs to be run
> before. I am wondering if anyone has solved this issue?
>
> My best solution (I don't think Django supports this) would be to have a
> special type of field called a DeprecatedField. It would delete the field
> from Django's perspective, but keep the column in the DB. Django would no
> longer query for the column, but the column would still be in the DB. On
> the next release, I could remove the column completely (with a RemoveField
> operation) and the existing code would not error because it has no
> knowledge of the column.
>
> I noticed Django has an idea of a private field, which is on a model but
> not in the DB. Is there a way to create a field that is in the DB, but
> Django model doesn't query for it or allow it to be used in creates and
> updates? Very similar to the managed=False on the Model, but on the Field
> level. If anyone has other approaches to the problem, I would be very
> excited to find alternative methods.
>
> Thanks,
> Taylor
>
> --
> 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/a52ae01a-1a7d-43ce-a94f-fb00c4e1b7d1%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/CAFWa6tKPUdNopNynQYwBhNapgb%3Dt3quAfKi5ffKfj3mg6LtYEw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django webframework

2017-07-04 Thread Avraham Serour
I recommend against trying to make python run inside the JVM, specially if
you are not familiar with python. Just use the normal python 3.6 and be
happy

On Mon, Jul 3, 2017 at 5:33 PM, Vinicius Assef 
wrote:

> Hi Arun.
>
> Certainly you can learn Python and Django at the same time. But if you're
> really new to Python, I'd suggest you to follow the official Python
> tutorial [1] beforehand. You should understand basic Python datatypes, how
> OO works in Python and something about modules and packages.
>
> You're right, Django docs are awesome. I personally use Linux to develop
> and run Django. You can run Django in a JVM with some incompatibilities.
> Read the documentation Vijay sent you.
>
> [1] https://docs.python.org/3/tutorial/index.html
>
> --
> Vinicius Assef
>
>
>
> On 3 July 2017 at 02:48, arun kumar  wrote:
>
>> Hi,
>>
>> My name is arun and i am a junior software engineer.i am very new with
>> python and i want to develop a web project so first i have selected python
>> script but after doing some online research i found routing is very
>> difficult in python if you are a new programmer in pyhton
>>
>> so i finally decided to do this project with django because it supports
>> mvc.so i need your valuable suggestion if  i am new with pyhton is it ok to
>> go for django framework because i think documentation for django is very
>> good and it has less code and it supports many databases also.
>>
>> so please help me currently i am using windows so i want to ask which is
>> better linux or windows and apache tomcat is also required for this web
>> application project so basically i need a overview for django how to use
>> whether to use.
>>
>> --
>> 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/ms
>> gid/django-users/0942dee0-72c3-4f64-8e0c-a7d3607253b2%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/CAFmXjSCMtmj4rbagpnbcsc7%3DUU1Oie6rrtTpdT4VHEgkKQGjfA%
> 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/CAFWa6tKAJ%2B7BnmuePeCn97_DqLE-GPzf-xED%3D-%2BF_W5z11jNAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need to connect to django test database from out side of django(celery worker)

2017-06-27 Thread Avraham Serour
> how do I get the work process, which tries to access the data model, to
talk to the "test" database

The same way django has a settings.py file I believe your celery worker
should also have something similar.

When starting the worker you should tell it to use test_settings.py instead
of settings.py

You should create a special settings file to use for tests which will point
to the test database

Be sure the worker and the django test runner are pointed to the same
database, the django test runner creates and drops a database for the tests
https://docs.djangoproject.com/en/1.11/topics/testing/overview/#the-test-database


On Mon, Jun 26, 2017 at 9:57 PM, sarvi <sarvil...@gmail.com> wrote:

> The problem is not where I start the worker.
> You are absolutely right, i can start in the setup code as well and am
> fine with doign that.
>
> My problem, is wherever I start the work process, how do I get the work
> process, which tries to access the data model, to talk to the "test"
> database.
> When I start the work process it automatically talks to the "default"
> database, not the test database, that was created/connected to by the
> django testing code.
>
>
>
> On Monday, June 26, 2017 at 9:42:50 AM UTC-7, Avraham Serour wrote:
>>
>> I don't think you need to create a custom TestRunner, I believe it would
>> be enough to use setUp and tearDown to start and stop an external process,
>> which in your case would be a celery worker
>>
>> Would that work for you?
>>
>> On Mon, Jun 26, 2017 at 6:19 PM, sarvi <sarv...@gmail.com> wrote:
>>
>>> anybody have any suggestions on how I can do this?
>>>
>>>
>>> I essentially  want a worker process to connect to the django test
>>> database ?
>>>
>>>
>>> On Thursday, June 22, 2017 at 11:56:41 AM UTC-7, sarvi wrote:
>>>>
>>>> I do have and use eager = True for local developer testing, environment.
>>>> And I have been able to write test cases and they work in eager mode,
>>>> fine.
>>>>
>>>>
>>>> However, I do have a CI test environment, where I would like to be able
>>>> to run these same test suites with real asynchronous worker processes.
>>>> To make sure there are no problems when running them in a real world
>>>> distributed model a Implements well.
>>>>
>>>> So What I am trying to do is to create my own custom Django Test Runner
>>>> that
>>>>1. Lets the regular django test runner create/setup the test database
>>>>2. Start the Celery worker and have it talk to the same test
>>>> database.
>>>>
>>>> I am having a very tough time finding a way to do this.
>>>>
>>>> The closest answer I found was
>>>> https://stackoverflow.com/questions/42058295/make-celery-
>>>> use-djangos-test-database-without-task-always-eager
>>>>
>>>> But couldn't figure out how to implement/do the Advanced: Step 3 that
>>>> is suggested there.
>>>>
>>>>
>>>>
>>>> On Thursday, June 22, 2017 at 11:44:23 AM UTC-7, Avraham Serour wrote:
>>>>>
>>>>> Any special reason you are not using eager=true for celery under test?
>>>>>
>>>>> On Jun 22, 2017 7:17 PM, "sarvi" <sarv...@gmail.com> wrote:
>>>>>
>>>>>>
>>>>>> Can someone help me with how can I get my celery worker
>>>>>> process(standalone app outside of djanog) to talk to a django test 
>>>>>> database
>>>>>> ?
>>>>>>
>>>>>> I am trying to test a celery/django app.
>>>>>> I plan on starting the celery worker process with a custom TestRunner.
>>>>>> So that the worker process starts after the django test runner has
>>>>>> created the test database.
>>>>>>
>>>>>> DATABASES = {
>>>>>>
>>>>>> 'default': {
>>>>>>
>>>>>> 'ENGINE': 'django.db.backends.oracle',
>>>>>>
>>>>>> ..
>>>>>>
>>>>>> 'TEST': {
>>>>>>
>>>>>> 'USER': WIT_TEST_DB_USER,
>>>>>>
>>>>>> 'PASSWORD': WIT_TEST_DB_USER,
>>>>>>
>>>>>> }
>>>>>>
>>>>>> }
>>>>>&g

Re: Need to connect to django test database from out side of django(celery worker)

2017-06-26 Thread Avraham Serour
I don't think you need to create a custom TestRunner, I believe it would be
enough to use setUp and tearDown to start and stop an external process,
which in your case would be a celery worker

Would that work for you?

On Mon, Jun 26, 2017 at 6:19 PM, sarvi <sarvil...@gmail.com> wrote:

> anybody have any suggestions on how I can do this?
>
>
> I essentially  want a worker process to connect to the django test
> database ?
>
>
> On Thursday, June 22, 2017 at 11:56:41 AM UTC-7, sarvi wrote:
>>
>> I do have and use eager = True for local developer testing, environment.
>> And I have been able to write test cases and they work in eager mode,
>> fine.
>>
>>
>> However, I do have a CI test environment, where I would like to be able
>> to run these same test suites with real asynchronous worker processes.
>> To make sure there are no problems when running them in a real world
>> distributed model a Implements well.
>>
>> So What I am trying to do is to create my own custom Django Test Runner
>> that
>>1. Lets the regular django test runner create/setup the test database
>>2. Start the Celery worker and have it talk to the same test database.
>>
>> I am having a very tough time finding a way to do this.
>>
>> The closest answer I found was
>> https://stackoverflow.com/questions/42058295/make-celery-
>> use-djangos-test-database-without-task-always-eager
>>
>> But couldn't figure out how to implement/do the Advanced: Step 3 that is
>> suggested there.
>>
>>
>>
>> On Thursday, June 22, 2017 at 11:44:23 AM UTC-7, Avraham Serour wrote:
>>>
>>> Any special reason you are not using eager=true for celery under test?
>>>
>>> On Jun 22, 2017 7:17 PM, "sarvi" <sarv...@gmail.com> wrote:
>>>
>>>>
>>>> Can someone help me with how can I get my celery worker
>>>> process(standalone app outside of djanog) to talk to a django test database
>>>> ?
>>>>
>>>> I am trying to test a celery/django app.
>>>> I plan on starting the celery worker process with a custom TestRunner.
>>>> So that the worker process starts after the django test runner has
>>>> created the test database.
>>>>
>>>> DATABASES = {
>>>>
>>>> 'default': {
>>>>
>>>> 'ENGINE': 'django.db.backends.oracle',
>>>>
>>>> ..
>>>>
>>>> 'TEST': {
>>>>
>>>> 'USER': WIT_TEST_DB_USER,
>>>>
>>>> 'PASSWORD': WIT_TEST_DB_USER,
>>>>
>>>> }
>>>>
>>>> }
>>>>
>>>> }
>>>>
>>>> How can I setup the celery app environment so that when the tasks
>>>> access the the app.models.X, they are talk to the "test" database.
>>>>
>>>> Thanks,
>>>> Sarvi
>>>>
>>>> --
>>>> 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/ms
>>>> gid/django-users/e9ba0c8c-a4e3-4588-99ec-46be91c4ba1b%40goog
>>>> legroups.com
>>>> <https://groups.google.com/d/msgid/django-users/e9ba0c8c-a4e3-4588-99ec-46be91c4ba1b%40googlegroups.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/2bc42c7b-b601-4683-9eb4-ede77208ec5d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2bc42c7b-b601-4683-9eb4-ede77208ec5d%40googlegroups.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/CAFWa6tLzdFmG6RRO4P1%2BbE-g1Rem4f33Q2yn1RGY7p1nKsF-ig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need to connect to django test database from out side of django(celery worker)

2017-06-22 Thread Avraham Serour
Any special reason you are not using eager=true for celery under test?

On Jun 22, 2017 7:17 PM, "sarvi"  wrote:

>
> Can someone help me with how can I get my celery worker process(standalone
> app outside of djanog) to talk to a django test database ?
>
> I am trying to test a celery/django app.
> I plan on starting the celery worker process with a custom TestRunner.
> So that the worker process starts after the django test runner has created
> the test database.
>
> DATABASES = {
>
> 'default': {
>
> 'ENGINE': 'django.db.backends.oracle',
>
> ..
>
> 'TEST': {
>
> 'USER': WIT_TEST_DB_USER,
>
> 'PASSWORD': WIT_TEST_DB_USER,
>
> }
>
> }
>
> }
>
> How can I setup the celery app environment so that when the tasks access
> the the app.models.X, they are talk to the "test" database.
>
> Thanks,
> Sarvi
>
> --
> 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/e9ba0c8c-a4e3-4588-99ec-46be91c4ba1b%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/CAFWa6tLpVm19zVf71D06y-Svbxzp9NsgwS_%2BHTCLP_6qOu_Pjw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Legitimate way to allow uploading of folders

2017-06-22 Thread Avraham Serour
The server can accept files, the frontend may allow the user to select a
folder and send multiple files

On Jun 22, 2017 8:32 PM, "Mandeep Tondak"  wrote:

> As per my experience we can not upload folder but we can upload zip folder
> to server. You can unzip that folder and read all file and save to db.
>
> On Jun 22, 2017 10:41 PM, "ranvir singh" 
> wrote:
>
>> On Thursday, June 22, 2017 at 9:54:41 PM UTC+5:30, mandeep444 wrote:
>>>
>>> You can use zip folder for that.
>>>
>>> Are you saying that we allow only zip files to be uploaded by the user.
>>
>> --
>> ---
>> Ranvir Singh
>> https://ranvirsinghprojects.wordpress.com
>> https://github.com/singh1114
>> 
>>
>> --
>> 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/ms
>> gid/django-users/916bc3bd-53a7-486a-b2a1-f19bc66450f9%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/CAJri7SRQALHRdE%2B6C4uMske2c17t3ZmTHf8OA_-
> Bae93dz-WQQ%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/CAFWa6tLgZ_Pg%3DWwLqD1XBjasB8MxMYUjsQE2GwXk7mtv4thAXw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: New functionalities expected in Django 2.

2017-06-13 Thread Avraham Serour
https://docs.djangoproject.com/en/dev/releases/2.0/

On Tue, Jun 13, 2017 at 7:49 AM, Rohan Purekar 
wrote:

> Is django 2 going to have inbuilt package for creating API's to cater to
> ajax requests and JSON responses for which we use DRF. Another thing which
> was on my mind was If Django 2 will come out with support for Token Auth as
> a default package along with the current session based login.
>
> --
> 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/b539390d-dea4-418f-a94f-94b34447c047%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/CAFWa6tJ5uGs7xUQ%2Bs81z8b3MTvFPCT%3DoXqmPt485MvpvMHo6Fg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django+Haystack+Elastic issue

2017-05-24 Thread Avraham Serour
it sounds like elastic is paginating, did you check that?

On Tue, May 23, 2017 at 12:41 AM, Nick Gilmour  wrote:

> Hi all,
>
>
>
> I'm following an example to setup Django with Haystack and ES from here:
>
> https://krzysztofzuraw.com/blog/2016/haystack-elasticsearch-part-one.html
>
>
> Everything seems to be working OK except from the number of the results –
> they are always maximal 20. But actually a single query should give more
> than 50 results.
>
> So, where does this limitation come from? How can I change it?
>
> I cannot find a setting neither for haystack nor for django which prevents
> showing more than 20 results.
>
>
>
> Thanks,
>
> Nick
>
> --
> 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/CAH-drozT6m%2Be_KX4Kni_U5nJXQp8NF8EeXb9cJo5OOhtUt1LoQ
> %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/CAFWa6tL%3D1Hb3Ud1PXw6AgBue2oq9t1YnVLaOs0CNGWqyrF36-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Most efficient and scalable search strategy

2017-05-24 Thread Avraham Serour
take a look at the postgres fulltext search capabilities, I can't make any
promises for your old postgres version

another common approach is to index the search into elasticsearch and
querying elasticsearch for the searches, it should handles misspellings and
return the search results fast, but you may need to have a cluster of them
with at least a couple of machines. I worked on a system once with single
digits millions of entries with 6 machines (VM) running elasticsearch in a
cluster, search results weren't fast but was reasonable. Once we had to
re-index everything and it took a couple of days. We used django haystack,
you should take a look at that. The problem with this approach is that you
basically have a hook on the django model which copies some data over
elasticsearch everytime you save()


On Tue, May 23, 2017 at 12:14 PM, Mike Dewhirst 
wrote:

> Django 1.10, Postgres 9.1 (for the moment), Python 2.7 (for the moment) on
> Ubuntu 16.04
>
> The search I need is an intersection hit.
>
> We have a substance model with fields for ...
>
> - name
> - molecular formula with subscripted unicode numbers
> - CAS number
>
> plus a Synonym model in 1:n with substance and there might typically be
> half a dozen synonyms per substance.
>
> We also have a separateReference_Ozone table containing all the ozone
> depleting substances listed in the Montreal Protocol imported from a csv
> file. Fields include ...
>
> - abbreviation,
> - molecular formula with subscripted unicode numbers,
> - chemical isomer name
> - common chemical name
>
> If any of those Substance fields matches any of those Reference_Ozone
> field we have a hit and that substance is subject to the Montreal Protocol.
>
> In addition, we have to incude ingredient substances and their synonyms if
> our substance is a mixture.
>
> I have looked at SearchVector and thought about SearchVectorField. I have
> also looked at the Postgres docs regarding triggers and decided against
> that path. If we do it it will have to be done on save() in the app.
>
> Since we import the Montreal Protocol substances and there are fewer than
> 400 of them it occurs to me that during import I could make a single
> (large) field which contains the contents of those four other fields. The
> data is almost static for my purposes. There might be new substances added
> but only rarely. It is a read-only table.
>
> I could do the same for substances but the idea is that they will scale
> beyond millions. I'd prefer not to do  a similar dedicated search field for
> them because it would need updating on every save.
>
> We might also have to deal with English/US spelling issues such as 'ph'
> versus 'f'. I haven't examined the content in detail yet.
>
> So the question is, how to quickly/efficiently detect that a substance is
> subject to the Montreal Protocol?
>
> Thanks for any pointers
>
> 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/ms
> gid/django-users/065647f9-7347-7d75-d817-83ea795006ed%40dewhirst.com.au.
> 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/CAFWa6tJu9wH5ngszDseFgVWOQwYNi52uOmZa%2Bk1Q8OBeR3eYzg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multiplex results from (Django-Channels)

2017-04-27 Thread Avraham Serour
You should just get the room object attribute you need, like name or id,
instead of concatenating the whole object

On Apr 27, 2017 5:26 AM, "Yarnball"  wrote:

> I do appreciate the bit of direction youve provided. And if you're asking
> to be paid, then sorry but I'm working free on a community project so it
> isn't such an option. Also why it would be good to get help on this minor
> task.
>
> I'm almost there :)
>
> I took your advice and put it in a loop. I am seeing the result, but
> getting a `TypeError:  is not JSON serializable`
>
> @channel_session
>
> def ws_connect(message):
> room_id = Tag.objects.filter(owner=1).filter(chat__isnull=False).value
> s('chat__label').distinct()
> print('I see values here', room_id)
> for i in room_id:
> try:
> room = Room.objects.get(label=i['chat__label'])
> chathistory = room.messages.all().order_by('timestamp')
> Group('chat-' ).add(message.reply_channel)
> message.channel_session['room'] = room
> message.reply_channel.send({'text': json.dumps([msg.as_dict()
> for msg in chathistory.all()])})
>
>
> except Exception as e:
> print (str(e), ' Never happened')
> pass
>
>
> @channel_session
> def ws_receive(message):
> label = message.channel_session['room']
> room = Room.objects.get(label=label)
> data = json.loads(message['text'])
> m = room.messages.create(handle=data['handle'], message=data['message'
> ])
> Group('chat-'+label).send({'text': json.dumps([m.as_dict()])})
>
> --
> 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/5453a756-2e87-47be-8e81-4359e200d0db%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/CAFWa6t%2BBqX522gYNQoYNRM8jgFbuR%2Bbs_GFdKA3UpTfsRQJ-Zg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Alternative to celery

2017-04-20 Thread Avraham Serour
try googling 'python task queue'

see https://www.fullstackpython.com/task-queues.html

On Thu, Apr 20, 2017 at 12:25 PM, Andréas Kühne 
wrote:

> I don't know anything about the python-rq stuff - however redis can be
> configured to save to disk (see https://redis.io/topics/persistence) - so
> you wouldn't loose anything on a power-failure (if configured correctly).
> Redis is so much more than a cache nowadays.
>
> Regards,
>
> Andréas
>
> 2017-04-20 11:16 GMT+02:00 guettli :
>
>> Some years ago I used celery for a project.
>>
>> Today I face roughly the same use case again.
>>
>> The last time I used it, celery felt to heavy weighted, too complicated.
>>
>> I found this alternative: http://python-rq.org/
>>
>> There are two things which speak agains python-rq:
>>
>>  - redis is a cache. I need a persistent queue. If a power-failure
>> happens, no job must get lost.
>>
>>  - AFAIK python-rq uses python pickle to serialize data. I want a
>> language neutral data exchange format.
>>
>> At the moment my favourite protocol is gRPC (protocol-buffers). I never
>> used it up to now, but this would be a nice use case.
>>
>> Maybe I am missing the right terms. What does celery implement? According
>> to wikipedia "asynchronous task queue". But
>> my favorite search engine could not reveal a gRPC based server
>> implemented in Python 
>>
>> What do you think?
>>
>>
>> --
>> 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/ms
>> gid/django-users/d43d2cef-f1a1-418d-9d62-ecce85961fbb%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/CAK4qSCefVFpgZEw4Ar4AGDUSdOH-
> A-7-kvgysqeHY9zET1DHZQ%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/CAFWa6t%2B7WTzt7o1SoOV45YrL%2B%3DaD_X30E1yNFj3-ki54ivNL2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to get a mentor

2017-04-04 Thread Avraham Serour
Hi,

I suggest going to local meetups, you may meet people that could mentor or
help you on specific issues, or help you to find a mentor, they could
either know someone or know of local mentorship programs.

Where are you located?

On Tue, Apr 4, 2017 at 4:26 PM, Joe Landrigan  wrote:

> I need a mentor.  I've got an idea for a non-profit that I think could be
> spectacular, and I think Django is the right platform.  But, every time I
> run into a challenge it takes me days to solve for multiple reasons: I'm a
> father of 6, my job has nothing to do with Python, and I don't know what I
> don't know.  If I had someone who has actually made a site to guide me, I
> bet most of my time consuming roadblocks would be decimated. If anyone
> could suggest a good route to find a mentor, I'd be very grateful.  I've
> wasted far too much time trying to solve problems only to find a package
> that solves the problem perfectly weeks later.  Ideally, I'd like to find
> someone who has some entrepreneurial experience, but I'll take any help I
> can get!  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/f2a34670-12ad-41da-af56-bf7518b2d4b1%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/CAFWa6t%2BR2cz%2BvQpbbS9Q_U9yBP8YAE_zYq3ctMonhCW%3DUm%3DkfA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Login/Logout, single instance only

2017-04-03 Thread Avraham Serour
You could probably have a custom session management to only have one
session per user, when a user log in you can invalidate all the other user
sessions

On Mon, Apr 3, 2017 at 11:30 AM, miguel vfx  wrote:

> Good day! I was wondering if there's a way to limit a user account to be
> logged-in in just 1 single device? I mean is there a way to logout a user
> first (In all browsers), then login? Thank you.
>
> --
> 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/60fe0b1e-648b-4d8f-ab80-ffdfe8a518f5%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/CAFWa6tJQUFCJSyZJMGyciXpECZmO-6fYkuUCR2ir91Q0WFL1mA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it possible to write generic module?

2017-03-27 Thread Avraham Serour
yes, table name can a parameter to your function

what do you mean by "import this table"?

On Mon, Mar 27, 2017 at 3:41 PM, Det S. Pillner 
wrote:

> Hi all,
>
> I work on tools for my job based on Django 1.8.17. In different projects
> (with different databases) I use same routine to get some data (config
> data). My problem is: the way is every time the same: import model, get
> config data from database. The difference is: model name is in every
> database different.
>
> My question: Can I transfer source table name in kwargs params, import
> this table and get data? My test means no: table name is ever interpreted
> as string. And string has no object property...
>
>
> --
> 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/674a3571-b6b5-4da4-a8ce-0f918e1fe308%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/CAFWa6tKs-YKMvKDB_w7-QEtQmb8frkB%3DSbzKobjgjX4u6N_Rmg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: , received 404

2017-03-23 Thread Avraham Serour
Do you really have to use Apache for any reason?

If not I recommend using nginx+ uwsgi to deploy django, the killer feature
that convinced me to leave Apache was the simpler config file nginx have.

There are plenty of tutorials on how to deploy django like this, if you
don't find anything suitable I can point you to a good one or help you here
on the list

On Mar 23, 2017 1:21 PM, "李志明"  wrote:

> --System configuration:
>
> Ubuntu 14.04 Desktop,
> apache 2.4.7,
> python 3.4.3,
> Djanog 1.10.6
>
> -- Apache2 works fine and I can see its default page, but cannot view any
> Django page.
> -- Searched on Google, and found lots of documents, tried tons of them,
> still the same result.
>
> anyone has experience about deploying Django project to Apache? any help
> or pointer would be appreciated.
>
> --
> 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/e7be272d-2ffc-4dc6-aa10-20be35920c90%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/CAFWa6tKVS7taxskX-CqQbDzbDTs23p3%2BxDKM7oztfL%3DgxoKFQg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Testing a Django library

2017-03-21 Thread Avraham Serour
What are the different approaches you found?

I created a simple minimal project inside the tests folder


On Mar 21, 2017 9:59 PM, "bobhaugen"  wrote:

> Very interesting topic. We will be facing the same problem soon, and will
> hope to learn from your experience. Got a code repository yet?
> We're at https://github.com/django-rea
> If and when we have some good answers, I'll report back here.
>
> --
> 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/abec25d4-6f05-4749-ac12-9d350d5ce8ad%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/CAFWa6tK_6SR7CrpCL4iy7Opt5A0-TzTSxoQ4px%2B7rsrgYNxNBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Updating files without web server restart

2017-03-13 Thread Avraham Serour
you may use uwsgi and tell uwsgi to gracefully reload, it won't even close
any eventual tcp sockets, they will wait until the new code is loaded,
users will never now you reloaded the application

On Mon, Mar 13, 2017 at 3:25 PM, Thiago Parolin  wrote:

> We have a small webserver that is used by many projects (php) from many
> users.
> Now, i am hosting a django project.
>
> The problem is:
>  - when user changed some file in his project, the apache continues
> serving old file until restart the httpd service.
>  - the users don't have sudo access, and i don't want to give this power
> to them.
>
> How can i make apache identify changes without restart?
> I never had this problem with php before, and i am totally new to django...
> Sorry if this question is more about apache than django.
> 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/CACTnJ00E8bUSWxW_9-VrDb_ikfJ_
> tzSXWgrq431OWGhsvd8gkg%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/CAFWa6tKSutXH-oJA5q9d6mvRyncUwbssqbSYZb5gDpQFqRbEHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels - slow with limited number of connections

2017-03-05 Thread Avraham Serour
I don't think you need 500 workers, the number of workers depends on how
long will message will take to be processed not the number of concurrent
connections.

The worker job is to get a message and send to a bunch of clients, the ASGI
server, meaning the process actually holding the websocket, in your case
daphne, will actually upload the data.

Is the client and server running on the same computer?

Don't stress test your server manually, you should write a script to do it.

On Sun, Mar 5, 2017 at 1:28 PM, Lada B  wrote:

> HW performance with 1 user sending message every 100ms:
> https://i.imgur.com/5F4mKAI.png
>
>
> Yesterday i tried to use it in production and when there were 15 clients
> connected (each one pinging server every 2 seconds) nobody else could
> connect.
>
> I have default settings and I followed Getting started tutorial.
>
> --
> 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/d86b1eb9-3492-48bc-9460-365571585db5%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/CAFWa6tJV-dX26xobzahdy1H3WA054WhSfc3Nyb5HvRenmMbbbw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Web-based Voting System for our capstone project

2017-02-01 Thread Avraham Serour
I recommend instead of tweaking the admin app to just making your own
dashboard template.

You can start learning django by doing the official tutorial at
djangoproject.com

On Tue, Jan 31, 2017 at 2:44 PM, Genaro Lubong  wrote:

> I just want to ask, how can I customize my admin page and make some
> dashboard about the students(who have already voted and those who haven't
> yet), colleges and everything in my web app. As well as, how to print
> reports. I am very willing to be taught and learn from you guys, I am just
> a newbie to django, and advance thank you 
>
> --
> 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/CACY%3DutHvCCf0Kdsp9bhYEadsssVMbJ8x
> E%3D7g3X64XnD4iH60Hw%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/CAFWa6tJP7FXKeRr9qScjkZm-_GdhjUEt2x3x1mDPp7EcmAFCPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Wiring django-channels to html without javascript?

2017-01-29 Thread Avraham Serour
Yes, the client application connecting to the websocket server can be an
user using an interactive console, a python application or any other
software in any language.

But if your objective is to have a webpage then no, unfortunately web
browsers can only run javascript, if you really dislike javascript you may
even use some other language that can transpile to js such as coffescript
or typescript, but at the end the browser will still run javascript.

I still dream of the day that we will be able to run python on the browser

On Sun, Jan 29, 2017 at 5:51 PM, Nikoleta Misheva 
wrote:

> I used the console to test my app but now I want to wire my
> django-channels app to the html but I don't know any JS so is it possible
> to wire django-channels to html without using javascript? If it is possible
> how? Here
>  you
> can check my consumers.py and html template. I know less than 5% JS so any
> help would be appreciated :)
>
> --
> 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/2ce32eb5-e117-48f1-9fa8-eb4d050ea142%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/CAFWa6tKpGLe5Q0iPq%3D1_9n23%3Dmgh-Y7tTx_EJ--pwhfTzYWybg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django channels on IIS

2017-01-26 Thread Avraham Serour
if you are stuck on windows but not necessarily IIS you may try cygwin, I
once had to deploy on windows and after investigating some possibilities I
just installed cygwin and put nginx with uwsgi.

On Thu, Jan 26, 2017 at 9:55 AM, Алексей Кузуб  wrote:

> Thank you for your answers and advices. I have no possibility to use *nix
> platform, my employer wants it on IIS. I'll try to build it, thank you very
> much!
>
> среда, 25 января 2017 г., 21:14:22 UTC+3 пользователь Jani Tiainen написал:
>>
>> There exists 3rd party ASGI handler for IIS: https://github.com/mjkill
>> ough/iis-asgi-handler/
>>
>> It also requires at least IIS 8 and websocket protocol installed. More
>> details at https://www.iis.net/learn/get-started/whats-new-in-iis-8/
>> iis-80-websocket-protocol-support
>>
>> Note, you need to build that handler yourself, which then requires
>> another set of tools, visual studio 2015 and CMake 2.8+
>>
>> Also note that there is not much of installation instructions or how to
>> build package that you can just install to your server without installing
>> all the development tools there.
>>
>> I really suggest that you try to find some *nix platform to run required
>> parts, it's just plain simpler and more documented than IIS.
>>
>> On Wed, Jan 25, 2017 at 7:25 PM, Andrew Godwin 
>> wrote:
>>
>>> Hi,
>>>
>>> I am afraid I don't have experience using IIS - I don't know if it even
>>> supports HTTP/1.1 proxying, which is needed for WebSockets. Hopefully
>>> someone else can help.
>>>
>>> Andrew
>>>
>>> On Wed, Jan 25, 2017 at 6:35 AM, Алексей Кузуб 
>>> wrote:
>>>
 I have a project in Django and i want to use django channels for
 support websockets in my project, but i have a problem with IIS
 configuration. Could somebody helps me with configuration daphne in IIS or
 configuration IIS to support channels and daphne. Has somebody any
 expierence in it? And maybe somebody knows some ways to deploy
 django+channels on IIS with or without daphne?
 Sorry for my bad english.

 --
 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/ms
 gid/django-users/9364bca2-2a03-4ae7-b93b-ff105ff34d31%40goog
 legroups.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...@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/ms
>>> gid/django-users/CAFwN1urM2A4HBhPzbG4_Tgs_DKzab39-Pz_
>>> jzWa981AGfC0cYg%40mail.gmail.com
>>> 
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Jani Tiainen
>>
>> - Well planned is half done, and a half done has been sufficient before...
>>
> --
> 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/636597f8-5b05-403a-b118-e5e84a841b19%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 

Re: Django channels, running uwsgi and awsgi

2017-01-19 Thread Avraham Serour
I think you can do conditionals on your server block and proxy pass to the
correct upstream depending on your logic


On Thu, Jan 19, 2017 at 2:18 PM, Dev App  wrote:

>  There's not individual documentation for every situation because people's
>> choice of webserver and their OS versions and environments differ. If you
>> tell me what you're using I can try and provide some hints or links to
>> examples.
>
>
> I thought it would be easy now, since I understand the concept better, but
> it still wasn't easy.
>
>
> From django channels documentation
>
>>
>> the ideal thing is to be able to look for the Upgrade: WebSocket header
>> and distinguish connections by this
>
>
>
> So wha I need is in pseudo code,
>
> if Upgrade: WebSocket is present,
>   hand over requests to asgi (darphene)
> else
>   hand over requests to wsgi (uwsgi)
>
> I failed to find an example.
> So yes, please let me know how to do the dual setup with nginx in the
> front.
>
> I found https://www.nginx.com/blog/websocket-nginx/ but not readily
> applicable because the example there seems to
> proxy every requests.
>
> 2017년 1월 19일 목요일 오전 3시 40분 0초 UTC+9, Andrew Godwin 님의 말:
>
>>
>>
>> On Wed, Jan 18, 2017 at 12:33 AM, Dev App  wrote:
>>
>>>
>>> I hope there 's a documentation how to do "running-asgi-alongside-wsgi"
>>> https://channels.readthedocs.io/en/stable/deploying.html#run
>>> ning-asgi-alongside-wsgi
>>> (I tried google, but none found for how to do it)
>>>
>>> I'm just afraid to hand over every request to asgi which I don't know
>>> much about.
>>>
>>
>> There's not individual documentation for every situation because people's
>> choice of webserver and their OS versions and environments differ. If you
>> tell me what you're using I can try and provide some hints or links to
>> examples.
>>
>>
>>>
>>> I have another question.
>>>
>>> I'd like to send notification to websocket client when some signal
>>> (post-save, etc) occurs.
>>>
>>> For instance, if user-a starts following user-b (post-save signal
>>> occurs), (and this happens over wsgi, normal django),
>>> I'd like to send notification to user-b through websocket.
>>>
>>> Is the above usage possible with wsgi/asgi dual setup?
>>>
>>>
>> Yes, the dual setup still lets you send messages to channels from WSGI
>> workers, just not act on them.
>>
>>
>>>
>>> I didn't fully understand interface-server/channel-backend/workers
>>> concept.
>>> A single image could help people like me.
>>>
>>> I wonder if the following is correct?
>>>
>>> nginx --- wsgi --  django
>>> /
>>> nginx --- asgi --- redis ---/
>>>
>>> asgi is interface-server
>>> redis is channel-backend
>>> django is workers
>>>
>>>
>> That's not quite right, but close - the ASGI and WSGI workers live in
>> different places, because the ASGI ones are a separate process using
>> runworker and the WSGI ones run inside your WSGI server, and both can talk
>> to the channel layer (redis in your example).
>>
>> Any Python code can send to a channel - WSGI workers, management
>> commands, etc. You can just only act on messages on channels inside workers
>> or async code you write yourself.
>>
>> Andrew
>>
> --
> 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/3e352bf8-0ced-4ac3-94e3-fa28ced84d66%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/CAFWa6tL_wazx5Nn%3DSXwsi_OWEFhV9m9fsMEbdSvR8s77k%3DKdjw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Access Celery's subprocess in my Django app

2017-01-14 Thread Avraham Serour
Hi,

In my opinion the celery task should just write to the DB the relevant
data, no need to pass around and reprocess just to write the relevant data
from the result, the celery task can just import the django model and save
directly to the DB.

Usually you don't need to set the CELERY_RESULT_BACKEND

Avraham

On Fri, Jan 13, 2017 at 10:44 AM, Patricia Infante 
wrote:

> Hi everyone! I put Celery in my Django app so that the two other python
> programs can process the input from my Django app via doing subprocess
> method.
> My question is how do I access the output from the subprocess? Back then
> when I made just a python program, I access the log files (output from the
> two apps) via stdout and stderr. Is this the same when I use Celery in
> Django? Is the value of CELERY_RESULT_BACKEND (if I should assign my
> Django app's db here) affected by the log files?
>
> So far what I've done is:
> 1. Access the two apps via subprocess in my tasks.py
> 2. I assigned my broker's db, Redis, as my db for now for
> CELERY_RESULT_BACKEND. My plan is to get the log files and then save them
> to my Django app's db so that I can just access that db.
>
> Can you offer some help?
>
> --
> 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/35c76a39-5291-4153-b651-170409d2e65e%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/CAFWa6tJPNkzLtZtZgGKTt4i%3D%3Do9pc%3DwBLQeCzErZYtQy8b5OjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Migration issue on Webfaction

2017-01-05 Thread Avraham Serour
> which to my understanding is saying that migration 0033 is looking for
content within migration 0032, which it can't find.

yes, check that you committed the file, I've had this kind of error too
many times just because after creating the migration I forgot to git add

If you removed your migration files you may try to recover them from your
version control.

Alternatively ou may create an initial migration file that reflects the
current state of your production DB and fake apply the migrations

On Wed, Jan 4, 2017 at 4:57 PM, Richard Jackson 
wrote:

>
> Hi there - I'm incredibly inexperienced and using a Mezzanine-powered
> site, but this should still be an issue with my lack of Django
> understanding:
>
> My site  is currently down ("Internal
> Server Error") due to mishandled migrations. When I try to deploy the code
> to WebFaction I get the error message:
>
> django.db.migrations.graph.NodeNotFoundError: Migration
> vital_theme.0033_auto_20161220_1741 dependencies reference nonexistent
> parent node (u'vital_theme', u'0032_sitewidecontent')
>
> ...which to my understanding is saying that migration 0033 is looking for
> content within migration 0032, which it can't find.
>
> I think I've caused issues by messing up the migrations files (even
> locally removing all files in the migrations folder aside from __init__.py
> and making fresh migrations locally) and pushing up local databases which
> aren't matching what the uploaded code wants to see. Essentially I think
> I've messed up a lot and am not sure how to unmess this up.
>
> The site is working locally with a suitable version of the database, with
> one single, fresh, 0001_initial migration file.
>
> Please let me know the best course of action; I was expecting to be able
> to deploy the files and for the migration files to be overwritten but this
> hasn't been the case.
>
> Thanks,
>
> Rich
>
> --
> 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/1da1bf5d-656e-4ca9-a2a4-6ce462f89451%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/CAFWa6tLOwXQpx_h91x-HgRC9QyQtHvs-Ei0QNcw_H95i6MEfcA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Dynamic Models

2017-01-05 Thread Avraham Serour
you should read about metaclasses, basically it enables you to build class
definitions in runtime.

http://stackoverflow.com/questions/13/what-is-a-metaclass-in-python


On Thu, Jan 5, 2017 at 6:02 PM, Guilherme Leal <lealhu...@gmail.com> wrote:

> The "migrations on the fly" thing dont get to be a problem (since I gess
> we could call the migrations api to generate the migration).
> My concenrs would be contructing and refreshing the model cache (I say the
> "model cache" like the list accessed through django.apps.get_models() ),
> and the OBVIOUS performance issues that could be generated.
>
> Anyway, EVEN if it turns out to be impratical to production, i want to
> build it as a proof of concept, and see where it can go, so any help or
> ideias would be apreciated!
>
> 2017-01-05 13:52 GMT-02:00 Beautifulloop <darahs...@gmail.com>:
>
>> I think you just need to define a generic model. I dont see how what you
>> are asking is feasible since it would require that (on the fly that
>> migrations are made). You can write a generic model where the types can be
>> represented by a field name.
>>
>>
>> On Thursday, 5 January 2017 17:33:07 UTC+2, Guilherme Leal wrote:
>>>
>>> My idea was to build an user interface for the model definition, so the
>>> developer (or in this case, the user) could define the model using a
>>> register form.
>>>
>>> Like a user interface to define the model layer, I gess.
>>>
>>> 2017-01-05 12:34 GMT-02:00 Avraham Serour <tov...@gmail.com>:
>>>
>>>> I guess you could play with metaclasses and generate the class
>>>> definition on runtime using information from the database
>>>>
>>>> But why? You can save the model definition on files, why saving them to
>>>> database and complicate your life?
>>>>
>>>> On Wed, Jan 4, 2017 at 10:38 PM, Guilherme Leal <leal...@gmail.com>
>>>> wrote:
>>>>
>>>>> Is there a way to populate Django model cache on the fly?
>>>>> I was thinking about saving the model definition on some backend
>>>>> (database for instance) and loading as needed. This way we can basically
>>>>> build a custom admin interface for the model definitions, and load the
>>>>> models (through "type()" or something similar) into the cache "on the 
>>>>> fly".
>>>>>
>>>>> Guilherme Leal
>>>>>
>>>>> --
>>>>> 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/CAOs3Lp7_R4RK
>>>>> %3DVconoQ1W6rzK8xYaiVJX-FHtyZ3Cxg4MmbOow%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/django-users/CAOs3Lp7_R4RK%3DVconoQ1W6rzK8xYaiVJX-FHtyZ3Cxg4MmbOow%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...@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/ms
>>>> gid/django-users/CAFWa6t%2B5DO5u8p5fRrGAGkW1KYR2DZxc_wtkNQG7
>>>> bX3u6v7JuA%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAFWa6t%2B5DO5u8p5fRrGAGkW1KYR2DZxc_wtkNQG7bX3u6v7JuA%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
>> 

Re: Dynamic Models

2017-01-05 Thread Avraham Serour
I guess you could play with metaclasses and generate the class definition
on runtime using information from the database

But why? You can save the model definition on files, why saving them to
database and complicate your life?

On Wed, Jan 4, 2017 at 10:38 PM, Guilherme Leal  wrote:

> Is there a way to populate Django model cache on the fly?
> I was thinking about saving the model definition on some backend (database
> for instance) and loading as needed. This way we can basically build a
> custom admin interface for the model definitions, and load the models
> (through "type()" or something similar) into the cache "on the fly".
>
> Guilherme Leal
>
> --
> 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/CAOs3Lp7_R4RK%3DVconoQ1W6rzK8xYaiVJX-
> FHtyZ3Cxg4MmbOow%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/CAFWa6t%2B5DO5u8p5fRrGAGkW1KYR2DZxc_wtkNQG7bX3u6v7JuA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: good pratices to write many lines on database

2017-01-04 Thread Avraham Serour
can you elaborate on this scenario? how and why can your database shutdown?

I second the suggestion about returning error and telling the client to try
later, but it should be >=500 not 400. 4xx Are for client errors, 5xx are
for server errors. see http://www.restapitutorial.com/httpstatuscodes.html

On Wed, Jan 4, 2017 at 10:47 PM, Vinicius Assef 
wrote:

> Or you could return a http status 400 if the transaction couldn't be
> committed. So, the client should re-run the request later.
>
> If this is not an option, you should lay upon a queue as you suggested.
>
> Bad things always can happen. So, try your best to avoid i/o problems
> if your clients cannot re-make requests in case of problems in your
> side.
>
> --
> Vinicius Assef
>
>
>
> On 4 January 2017 at 14:39, Bruno Barbosa  wrote:
> > Hello everybody!
> >
> > I have an application that receives about 1000 POST requests per second.
> On
> > each request I writte a line on my database table. On this scenario my
> > database can shutdown during execution.
> >
> > Is it a good pratice to store these data on array in cache (redis) and on
> > each minute through celery get then and use a bulk_create to insert all
> data
> > on database?
> >
> > Bruno
> > --
> >
> > --
> > 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/CAHxcCH5t7FWRoXbCFvUez-
> hAzLk0b08KideZ_D_A6oj6a_8L1A%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/CAFmXjSDsYp44V8mVwkdwX-FVww%3D-NhYm4w-KnDZ4rw5SQo5owg%
> 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/CAFWa6tJQCkmJ%2BnM4nbw2snR0TguG7DPYvKLqN2__OtdFK314Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: request.read() is empty in POST

2017-01-04 Thread Avraham Serour
aand you are angry.

So we can start yet another flame war, if that's the case I'll reply to
each of your points.

If you still want help you may reply to the first reply of this thread,
which was trying to help but was ignored. I'm also willing to call you and
help for at least 20min, just send me a landline number and if it is from
one of the 50 countries included in my plan I will make the effort, it
seems you are from Brasil, if that's the case honestly I'm afraid you might
be angry and impatient, but I'm willing to take the risk.

On Wed, Jan 4, 2017 at 10:06 PM, Flávio Cardoso <flavio.scard...@gmail.com>
wrote:

> Childish? Ok, so I'm stuck, my project is stopped, nobody, no one, even
> YOU, can give me a hand. I spent days researching and debugging trying to
> solve the problem.
>
> I've been waiting for days for anything and nothing, nobody, including YOU
> told nothing to help me.
>
> If the platform - AND THE COMUNITY - can't give help nor results, I'll
> jump to another, simply that. The documentation is also poor.
>
> And you're donating your own time to what? Complain? Did you give me some
> help? No!
>
> So, if you're feeling bad with it, sorry, but I have to give value to my
> clients, not lose my time with children complaining because I gave up with
> a product that can't attend me.
>
> Wont you point a solution instead of being a crying baby?
>
>
> Em quarta-feira, 4 de janeiro de 2017 13:13:43 UTC-2, Avraham Serour
> escreveu:
>
>> That's an incredibly childish response and I hope future people trying to
>> learn python or django don't give up upon a roadblock, any future people
>> reading this don't ever feel that you are helpless, the community has many
>> resources to help including this mailing list.
>>
>> Sometimes it is difficult to express yourself in a foreign language, I
>> always suggest to join local mailing list and contact people in your own
>> mother tongue.
>>
>> Sometimes it is difficult to formulate a clear question in writing,
>> specially in something one is not familiar with, I suggest looking for
>> local meetups and talk personally about your bug.
>> There are also some mentoring programs in some local communities, be sure
>> to ask on local mailing lists for those
>>
>> Time is money, and it is obvious that it takes time to learn anything,
>> take into consideration that everyone here is donating their own time.
>>
>> On Wed, Jan 4, 2017 at 3:22 PM, Flávio Cardoso <flavio@gmail.com>
>> wrote:
>>
>>> I work with ASP.Net since version 1.1. I've never been with a stuck
>>> project.
>>>
>>> I'm trying to directly read the request because it is application/json,
>>> so Django doesn't delivery the data via request.GET nor .POST.
>>>
>>> And I got an exception on request.body: raise RawPostDataException("You
>>> cannot access body after reading from request's data stream")
>>>
>>>
>>> So, nevermind, you know, time is money. I was trying to learn new stuff,
>>> but I'm having many problems. Thank you.
>>>
>>>
>>> Em quarta-feira, 4 de janeiro de 2017 02:26:54 UTC-2, Vijay Khemlani
>>> escreveu:
>>>
>>>> Yeah, because hitting a roadblock only happens in Django
>>>>
>>>> Why are you trying to read the request directly? django parses it in
>>>> request.body, request.GET, request.POST, request.FILES, etc
>>>>
>>>> https://docs.djangoproject.com/en/1.10/ref/request-response/
>>>>
>>>> On 1/4/17, Flávio Cardoso <flavio@gmail.com> wrote:
>>>> > Wow, that's sad :(
>>>> >
>>>> > I'll port it to C#
>>>> >
>>>> >
>>>> >
>>>> > Em sexta-feira, 30 de dezembro de 2016 19:52:49 UTC-2, Flávio Cardoso
>>>> > escreveu:
>>>> >
>>>> >> Hello! I'm getting crazy, PLEASE someone, give me some light!!!
>>>> >>
>>>> >> I'm using Django 1.10.4, Python 3.5 on Windows using Visual Studio
>>>> >> Community 2015.
>>>> >>
>>>> >> I have some class-based views to response some json.
>>>> >>
>>>> >> from django.views.generic import View
>>>> >> from json import loads
>>>> >> from bson.json_util import dumps
>>>> >> from django.http import HttpResponse, HttpRequest
>>>> >>
>>>> >> class Topicos(View):
>>>> >>def post(self, request):
&g

Re: DateField default value in SQLite and Postgres

2017-01-04 Thread Avraham Serour
> Because attempting to interpret the string '17/06/2017' as a date is
risky and will lead to trouble sooner or later, regardless the backend.
This is a valid point, but I believe this is related to sqlite behaviour
not the ORM using it.

mysql for example has its own bugs, there was one about truncating silently
too long values assigned to a column. If I am using postgres why should my
library limit me with mysql limitations?

> I use SQLite locally for development and Postgres in production. So when
my migration runs fine locally I expect it to also work fine when I upload
it 5 minutes later and try to apply it to my Postgres database.

This is a valid point to run tests, you really should have a gitlab,
jenkins, travis whatever running tests because this is not the only
difference between sqlite and postgres

On Wed, Jan 4, 2017 at 5:11 PM, <jorrit...@gmail.com> wrote:

> I use SQLite locally for development and Postgres in production. So when
> my migration runs fine locally I expect it to also work fine when I upload
> it 5 minutes later and try to apply it to my Postgres database.
>
>
> On Wednesday, January 4, 2017 at 3:59:52 PM UTC+1, Avraham Serour wrote:
>>
>> well the ORM does abstract the different API's for each backend, you may
>> give an datetime object and it will take care to format to the appropriate
>> thing the backend needs.
>>
>> you are right that it does not check the type of the value passed, it is
>> a valid point that the library should check the type, but on the other hand
>> if one is using sqlite why enforce stricter rules than the backend I'm
>> using just because one other backend has a problem with it?
>>
>> Also this is python, if it quacks like a duck then it is a duck, right?
>>
>>
>> On Wed, Jan 4, 2017 at 3:24 PM, Antonis Christofides <
>> ant...@djangodeployment.com> wrote:
>>
>>> Instead of default='17/06/2017', you should write
>>> default=datetime(2017, 6, 17). The bug in Django (if it is a bug, and I
>>> think it is) is that it does not require you to do so. There's probably a
>>> reason for it, but I don't really know..
>>>
>>> Regards,
>>>
>>> Antonis
>>>
>>> Antonis Christofideshttp://djangodeployment.com
>>>
>>>
>>> On 01/04/2017 03:10 PM, jorr...@gmail.com wrote:
>>>
>>> I thought the whole point of an ORM was to abstract away differences
>>> between backends... That's why this seems like a bug to me.
>>>
>>>
>>> On Wednesday, January 4, 2017 at 1:02:07 PM UTC+1, Avraham Serour wrote:
>>>>
>>>> Well this is the reality right now, if you think the framework is
>>>> acting wrong you may file a bug report.
>>>>
>>>> In my opinion the wrong side of the equation is you, the framework is
>>>> just passing the value you assigned, the ORM tries to make a consistent API
>>>> between backends but I wouldn't really expect the same behaviour from all
>>>> backends, after all they are different backends, they will have different
>>>> bugs, performance and ultimately different behaviour
>>>>
>>>> On Wed, Jan 4, 2017 at 1:47 PM, <jorr...@gmail.com> wrote:
>>>>
>>>>> The fact that some backends are more forgiving is exactly my point.
>>>>> Maybe the migrations engine should always force a datetime object (or at
>>>>> least a -MM-DD notation) to make it work consistently on all backends.
>>>>>
>>>>>
>>>>> On Wednesday, January 4, 2017 at 11:35:38 AM UTC+1, Avraham Serour
>>>>> wrote:
>>>>>>
>>>>>> DateField is a representation of datetime.date, so you should assign
>>>>>> a date object and not a string, sqlite is more forgiving and doesn't
>>>>>> complain so much in many cases
>>>>>>
>>>>>> On Wed, Jan 4, 2017 at 12:13 AM, <jorr...@gmail.com> wrote:
>>>>>>
>>>>>>> This field:
>>>>>>>
>>>>>>> activity_date = models.DateField('Datum', default='17/06/2017')
>>>>>>>
>>>>>>>
>>>>>>> Results in this migration:
>>>>>>>
>>>>>>> class Migration(migrations.Migration):
>>>>>>>
>>>>>>> dependencies = [
>>>>>>> ('activities', '0006_auto_20161231_1703'),]
>>>>>>>
>>>>>>> operations = [
>>>>>>> 

Re: request.read() is empty in POST

2017-01-04 Thread Avraham Serour
That's an incredibly childish response and I hope future people trying to
learn python or django don't give up upon a roadblock, any future people
reading this don't ever feel that you are helpless, the community has many
resources to help including this mailing list.

Sometimes it is difficult to express yourself in a foreign language, I
always suggest to join local mailing list and contact people in your own
mother tongue.

Sometimes it is difficult to formulate a clear question in writing,
specially in something one is not familiar with, I suggest looking for
local meetups and talk personally about your bug.
There are also some mentoring programs in some local communities, be sure
to ask on local mailing lists for those

Time is money, and it is obvious that it takes time to learn anything, take
into consideration that everyone here is donating their own time.

On Wed, Jan 4, 2017 at 3:22 PM, Flávio Cardoso 
wrote:

> I work with ASP.Net since version 1.1. I've never been with a stuck
> project.
>
> I'm trying to directly read the request because it is application/json,
> so Django doesn't delivery the data via request.GET nor .POST.
>
> And I got an exception on request.body: raise RawPostDataException("You
> cannot access body after reading from request's data stream")
>
>
> So, nevermind, you know, time is money. I was trying to learn new stuff,
> but I'm having many problems. Thank you.
>
>
> Em quarta-feira, 4 de janeiro de 2017 02:26:54 UTC-2, Vijay Khemlani
> escreveu:
>
>> Yeah, because hitting a roadblock only happens in Django
>>
>> Why are you trying to read the request directly? django parses it in
>> request.body, request.GET, request.POST, request.FILES, etc
>>
>> https://docs.djangoproject.com/en/1.10/ref/request-response/
>>
>> On 1/4/17, Flávio Cardoso  wrote:
>> > Wow, that's sad :(
>> >
>> > I'll port it to C#
>> >
>> >
>> >
>> > Em sexta-feira, 30 de dezembro de 2016 19:52:49 UTC-2, Flávio Cardoso
>> > escreveu:
>> >
>> >> Hello! I'm getting crazy, PLEASE someone, give me some light!!!
>> >>
>> >> I'm using Django 1.10.4, Python 3.5 on Windows using Visual Studio
>> >> Community 2015.
>> >>
>> >> I have some class-based views to response some json.
>> >>
>> >> from django.views.generic import View
>> >> from json import loads
>> >> from bson.json_util import dumps
>> >> from django.http import HttpResponse, HttpRequest
>> >>
>> >> class Topicos(View):
>> >>def post(self, request):
>> >>req = request.read().decode(self.request.encoding)
>> >>
>> >> Have the following setting on urls.py:
>> >>
>> >> url(r'^api/Topicos', Topicos.Topicos.as_view(), name='Topicos'),
>> >>
>> >> The request.read() is empty, the request is:
>> >>
>> >> POST /api/Topicos HTTP/1.1
>> >> Host: localhost:55020
>> >> Connection: keep-alive
>> >> Content-Length: 93
>> >> Accept: application/json, text/plain, */*
>> >> Origin: http://localhost:55020
>> >> User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
>> AppleWebKit/537.36
>> >> (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
>> >> X-CSRFToken:
>> >> VRiCt3Lz1EIdKGWt3lknpcgdFpD8XbrwSxdPT4P9dd1tbrGYmgE8uHdEIH2dzP5h
>> >> Content-Type: application/json;charset=UTF-8
>> >> Referer: http://localhost:55020/
>> >> Accept-Encoding: gzip, deflate, br
>> >> Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4
>> >> Cookie:
>> >> csrftoken=VRiCt3Lz1EIdKGWt3lknpcgdFpD8XbrwSxdPT4P9dd1tbrGYmgE8uHdEIH2dzP5h
>>
>> >>
>> >> {"titulo":"Título 1","mensagem":"mensagem","email":"fla...@email.test
>> >> .br","usuario":"Flávio"}
>> >>
>> >>
>> >> I really don't know what else I can do. I have the same code (except
>> na
>> >> class name) running correctly to another posts.
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >
>> > --
>> > 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/1da72b67-1eb4
>> -4dde-9e13-b3faa8d7c0c0%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/5e883f24-bea9-4ffe-b183-741ea919fefe%40googlegroups.com
> 

Re: DateField default value in SQLite and Postgres

2017-01-04 Thread Avraham Serour
well the ORM does abstract the different API's for each backend, you may
give an datetime object and it will take care to format to the appropriate
thing the backend needs.

you are right that it does not check the type of the value passed, it is a
valid point that the library should check the type, but on the other hand
if one is using sqlite why enforce stricter rules than the backend I'm
using just because one other backend has a problem with it?

Also this is python, if it quacks like a duck then it is a duck, right?


On Wed, Jan 4, 2017 at 3:24 PM, Antonis Christofides <
anto...@djangodeployment.com> wrote:

> Instead of default='17/06/2017', you should write default=datetime(2017,
> 6, 17). The bug in Django (if it is a bug, and I think it is) is that it
> does not require you to do so. There's probably a reason for it, but I
> don't really know..
>
> Regards,
>
> Antonis
>
> Antonis Christofideshttp://djangodeployment.com
>
>
> On 01/04/2017 03:10 PM, jorrit...@gmail.com wrote:
>
> I thought the whole point of an ORM was to abstract away differences
> between backends... That's why this seems like a bug to me.
>
>
> On Wednesday, January 4, 2017 at 1:02:07 PM UTC+1, Avraham Serour wrote:
>>
>> Well this is the reality right now, if you think the framework is acting
>> wrong you may file a bug report.
>>
>> In my opinion the wrong side of the equation is you, the framework is
>> just passing the value you assigned, the ORM tries to make a consistent API
>> between backends but I wouldn't really expect the same behaviour from all
>> backends, after all they are different backends, they will have different
>> bugs, performance and ultimately different behaviour
>>
>> On Wed, Jan 4, 2017 at 1:47 PM, <jorr...@gmail.com> wrote:
>>
>>> The fact that some backends are more forgiving is exactly my point.
>>> Maybe the migrations engine should always force a datetime object (or at
>>> least a -MM-DD notation) to make it work consistently on all backends.
>>>
>>>
>>> On Wednesday, January 4, 2017 at 11:35:38 AM UTC+1, Avraham Serour wrote:
>>>>
>>>> DateField is a representation of datetime.date, so you should assign a
>>>> date object and not a string, sqlite is more forgiving and doesn't complain
>>>> so much in many cases
>>>>
>>>> On Wed, Jan 4, 2017 at 12:13 AM, <jorr...@gmail.com> wrote:
>>>>
>>>>> This field:
>>>>>
>>>>> activity_date = models.DateField('Datum', default='17/06/2017')
>>>>>
>>>>>
>>>>> Results in this migration:
>>>>>
>>>>> class Migration(migrations.Migration):
>>>>>
>>>>> dependencies = [
>>>>> ('activities', '0006_auto_20161231_1703'),]
>>>>>
>>>>> operations = [
>>>>> migrations.AlterField(
>>>>> model_name='activity',name='activity_date',   
>>>>>  field=models.DateField(default='17/06/2017', verbose_name='Datum'),  
>>>>>   ),]
>>>>>
>>>>> Which works fine on SQLite but gives this error on Postgres:
>>>>> Operations to perform:   Apply all migrations: activities, addressbook
>>>>> , admin, auth, contenttypes, sessions, users Running migrations:
>>>>> Applying activities.0007_auto_20170103_2309...Traceback (most recent
>>>>> call last):   File "manage.py", line 22, in 
>>>>> execute_from_command_line(sys.argv)   File
>>>>> "/webapps/mzg/venv/lib/python3.5/site-packages/django/core/
>>>>> management/__init__.py", line 367, in execute_from_command_line
>>>>> utility.execute()   File "/webapps/mzg/venv/lib/python3
>>>>> .5/site-packages/django/core/management/__init__.py", line 359, in
>>>>> execute self.fetch_command(subcommand).run_from_argv(self.argv)
>>>>> File "/webapps/mzg/venv/lib/python3.5/site-packages/django/core/
>>>>> management/base.py", line 294, in run_from_argv self.execute(*args
>>>>> , **cmd_options)   File "/webapps/mzg/venv/lib/python3
>>>>> .5/site-packages/django/core/management/base.py", line 345, in
>>>>> execute output = self.handle(*args, **options)   File
>>>>> "/webapps/mzg/venv/lib/python3.5/site-packages/django/core/
>>>>> management/commands/migrate.py", line 204, in handle fake_initial=
>&

Re: DateField default value in SQLite and Postgres

2017-01-04 Thread Avraham Serour
Well this is the reality right now, if you think the framework is acting
wrong you may file a bug report.

In my opinion the wrong side of the equation is you, the framework is just
passing the value you assigned, the ORM tries to make a consistent API
between backends but I wouldn't really expect the same behaviour from all
backends, after all they are different backends, they will have different
bugs, performance and ultimately different behaviour

On Wed, Jan 4, 2017 at 1:47 PM, <jorrit...@gmail.com> wrote:

> The fact that some backends are more forgiving is exactly my point. Maybe
> the migrations engine should always force a datetime object (or at least a
> -MM-DD notation) to make it work consistently on all backends.
>
>
> On Wednesday, January 4, 2017 at 11:35:38 AM UTC+1, Avraham Serour wrote:
>>
>> DateField is a representation of datetime.date, so you should assign a
>> date object and not a string, sqlite is more forgiving and doesn't complain
>> so much in many cases
>>
>> On Wed, Jan 4, 2017 at 12:13 AM, <jorr...@gmail.com> wrote:
>>
>>> This field:
>>>
>>> activity_date = models.DateField('Datum', default='17/06/2017')
>>>
>>>
>>> Results in this migration:
>>>
>>> class Migration(migrations.Migration):
>>>
>>> dependencies = [
>>> ('activities', '0006_auto_20161231_1703'),
>>> ]
>>>
>>> operations = [
>>> migrations.AlterField(
>>> model_name='activity',
>>> name='activity_date',
>>> field=models.DateField(default='17/06/2017', 
>>> verbose_name='Datum'),
>>> ),
>>> ]
>>>
>>>
>>> Which works fine on SQLite but gives this error on Postgres:
>>>
>>> Operations to perform:
>>>   Apply all migrations: activities, addressbook, admin, auth,
>>> contenttypes, sessions, users
>>> Running migrations:
>>>   Applying activities.0007_auto_20170103_2309...Traceback (most recent
>>> call last):
>>>   File "manage.py", line 22, in 
>>> execute_from_command_line(sys.argv)
>>>   File "/webapps/mzg/venv/lib/python3.5/site-packages/django/core/
>>> management/__init__.py", line 367, in execute_from_command_line
>>> utility.execute()
>>>   File "/webapps/mzg/venv/lib/python3.5/site-packages/django/core/
>>> management/__init__.py", line 359, in execute
>>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>>   File "/webapps/mzg/venv/lib/python3.5/site-packages/django/core/
>>> management/base.py", line 294, in run_from_argv
>>> self.execute(*args, **cmd_options)
>>>   File "/webapps/mzg/venv/lib/python3.5/site-packages/django/core/
>>> management/base.py", line 345, in execute
>>> output = self.handle(*args, **options)
>>>   File "/webapps/mzg/venv/lib/python3.5/site-packages/django/core/
>>> management/commands/migrate.py", line 204, in handle
>>> fake_initial=fake_initial,
>>>   File "/webapps/mzg/venv/lib/python3.5/site-packages/django/db/
>>> migrations/executor.py", line 115, in migrate
>>> state = self._migrate_all_forwards(state, plan, full_plan, fake=fake
>>> , fake_initial=fake_initial)
>>>   File "/webapps/mzg/venv/lib/python3.5/site-packages/django/db/
>>> migrations/executor.py", line 145, in _migrate_all_forwards
>>> state = self.apply_migration(state, migration, fake=fake,
>>> fake_initial=fake_initial)
>>>   File "/webapps/mzg/venv/lib/python3.5/site-packages/django/db/
>>> migrations/executor.py", line 244, in apply_migration
>>> state = migration.apply(state, schema_editor)
>>>   File "/webapps/mzg/venv/lib/python3.5/site-packages/django/db/
>>> migrations/migration.py", line 129, in apply
>>> operation.database_forwards(self.app_label, schema_editor, old_state
>>> , project_state)
>>>   File "/webapps/mzg/venv/lib/python3.5/site-packages/django/db/
>>> migrations/operations/fields.py", line 204, in database_forwards
>>> schema_editor.alter_field(from_model, from_field, to_field)
>>>   File "/webapps/mzg/venv/lib/python3.5/site-packages/django/db/
>>> backends/base/schema.py", line 495, in alter_field
>>> old_db_params, new_db_params, strict)
>>>   File "/webapps/mzg/venv/lib/python3.5/site-packages/django/db/
>>> backends/postgresql

Re: DateField default value in SQLite and Postgres

2017-01-04 Thread Avraham Serour
DateField is a representation of datetime.date, so you should assign a date
object and not a string, sqlite is more forgiving and doesn't complain so
much in many cases

On Wed, Jan 4, 2017 at 12:13 AM, <jorrit...@gmail.com> wrote:

> This field:
>
> activity_date = models.DateField('Datum', default='17/06/2017')
>
>
> Results in this migration:
>
> class Migration(migrations.Migration):
>
> dependencies = [
> ('activities', '0006_auto_20161231_1703'),
> ]
>
> operations = [
> migrations.AlterField(
> model_name='activity',
> name='activity_date',
> field=models.DateField(default='17/06/2017', 
> verbose_name='Datum'),
> ),
> ]
>
>
> Which works fine on SQLite but gives this error on Postgres:
>
> Operations to perform:
>   Apply all migrations: activities, addressbook, admin, auth, contenttypes
> , sessions, users
> Running migrations:
>   Applying activities.0007_auto_20170103_2309...Traceback (most recent
> call last):
>   File "manage.py", line 22, in 
> execute_from_command_line(sys.argv)
>   File "/webapps/mzg/venv/lib/python3.5/site-packages/
> django/core/management/__init__.py", line 367, in
> execute_from_command_line
> utility.execute()
>   File "/webapps/mzg/venv/lib/python3.5/site-packages/
> django/core/management/__init__.py", line 359, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/webapps/mzg/venv/lib/python3.5/site-packages/
> django/core/management/base.py", line 294, in run_from_argv
> self.execute(*args, **cmd_options)
>   File "/webapps/mzg/venv/lib/python3.5/site-packages/
> django/core/management/base.py", line 345, in execute
> output = self.handle(*args, **options)
>   File "/webapps/mzg/venv/lib/python3.5/site-packages/
> django/core/management/commands/migrate.py", line 204, in handle
> fake_initial=fake_initial,
>   File "/webapps/mzg/venv/lib/python3.5/site-packages/
> django/db/migrations/executor.py", line 115, in migrate
> state = self._migrate_all_forwards(state, plan, full_plan, fake=fake,
> fake_initial=fake_initial)
>   File "/webapps/mzg/venv/lib/python3.5/site-packages/
> django/db/migrations/executor.py", line 145, in _migrate_all_forwards
> state = self.apply_migration(state, migration, fake=fake, fake_initial
> =fake_initial)
>   File "/webapps/mzg/venv/lib/python3.5/site-packages/
> django/db/migrations/executor.py", line 244, in apply_migration
> state = migration.apply(state, schema_editor)
>   File "/webapps/mzg/venv/lib/python3.5/site-packages/
> django/db/migrations/migration.py", line 129, in apply
> operation.database_forwards(self.app_label, schema_editor, old_state,
> project_state)
>   File "/webapps/mzg/venv/lib/python3.5/site-packages/
> django/db/migrations/operations/fields.py", line 204, in database_forwards
> schema_editor.alter_field(from_model, from_field, to_field)
>   File "/webapps/mzg/venv/lib/python3.5/site-packages/
> django/db/backends/base/schema.py", line 495, in alter_field
> old_db_params, new_db_params, strict)
>   File "/webapps/mzg/venv/lib/python3.5/site-packages/
> django/db/backends/postgresql/schema.py", line 117, in _alter_field
> new_db_params, strict,
>   File "/webapps/mzg/venv/lib/python3.5/site-packages/
> django/db/backends/base/schema.py", line 578, in _alter_field
> new_default = self.effective_default(new_field)
>   File "/webapps/mzg/venv/lib/python3.5/site-packages/
> django/db/backends/base/schema.py", line 221, in effective_default
> default = field.get_db_prep_save(default, self.connection)
>   File "/webapps/mzg/venv/lib/python3.5/site-packages/
> django/db/models/fields/__init__.py", line 755, in get_db_prep_save
> prepared=False)
>   File "/webapps/mzg/venv/lib/python3.5/site-packages/
> django/db/models/fields/__init__.py", line 1280, in get_db_prep_value
> value = self.get_prep_value(value)
>   File "/webapps/mzg/venv/lib/python3.5/site-packages/
> django/db/models/fields/__init__.py", line 1275, in get_prep_value
> return self.to_python(value)
>   File "/webapps/mzg/venv/lib/python3.5/site-packages/
> django/db/models/fields/__init__.py", line 1250, in to_python
> params={'value': value},
> django.core.exceptions.ValidationError: ["'17/06/2017' waarde heeft een
> ongeldige datumnotatie. Deze moet in de -MM-DD notatie opgegeven
> worden."]
>
>
>
> The error says: "DATE" has an invalid date notation. It must be submitted
&g

Re: DateField default value in SQLite and Postgres

2017-01-03 Thread Avraham Serour
please post your migration file and the error

On Tue, Jan 3, 2017 at 12:00 PM,  wrote:

> I recently set a default value in my local date format on a DateTimeField
> while I was using SQLite. The migration ran fine on my SQLite dev database,
> but when trying to apply the migration on my production Postgres database I
> got an error saying that a default value for DateTimeField must be in the
> format of '-MM-DD'. Wouldn't it be prudent to force users to always
> specify the default value in the '-MM-DD' format to avoid this problem
> of portability? (Not sure how MySQL handles it)
>
> --
> 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/4f8e0aad-9c6e-45c5-a476-22f604584b0a%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/CAFWa6tJsWibLJO6wnKYe-Z2LgbRbPu_J5GsE_s-5urBJ6EiONQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: can anyone tell django deployment process with apache, mod_wsgi using aws ec2 hosting requirements

2017-01-03 Thread Avraham Serour
https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-uwsgi-and-nginx-on-ubuntu-16-04

On Tue, Jan 3, 2017 at 1:58 PM, chowdam1992  wrote:

> So i can thankfull.
>
> --
> 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/8af4f3a5-c967-4e33-860e-1e2c08414895%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/CAFWa6t%2B9p97EeF4duoCVEJ8qZpgxBYvbMEvXxLS5defPW8vOqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Just added Python, Django and MySQL integration template for easier data visualization with AnyChart JS

2016-12-29 Thread Avraham Serour
I have no idea what anychartjs does, in any case I don't understand why a
js lib would need django integration.

Also it seems they have no idea what they are doing, the guthub repo linked
has .pyc files commited, anyone needing to use don't copy paste code from
there and take it with a kilo of salt.

On Thu, Dec 29, 2016 at 12:21 PM,  wrote:

> Hi all,
>
> We at AnyChart JS Charts  have just released a
> series of 20+ integration templates to help web developers add interactive
> charts, maps and dashboards to web apps much easier, no matter what your
> technology stack is.
>
> In particular, now there is a template for using our JavaScript charting
> libraries with Python, Django and MySQL
> 
> in our collection, distributed under the Apache 2.0 License and forkable on
> GitHub. (All technical integrations, just in case:
> http://www.anychart.com/integrations/.)
>
> Check that out, and ask your questions if any. 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/aec8bb48-2ceb-4dcb-9486-d66b5b989bd3%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/CAFWa6tJpbLZQjYoeGYRz_TQ4wpp0dxNHuw_t1Z%2BCEPK_8_5o5g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Define Django Base Model Class

2016-12-28 Thread Avraham Serour
You could monkeypatch django to accomplish this, but I would advise against
it.

Instead of having implicit or hidden behaviour you should instruct your
developers to use from myproject import models instead of from django.db
import models


On Wed, Dec 28, 2016 at 7:13 PM, Guilherme Leal  wrote:

> In one of my django projects, I have a base model (that inherits
> from django.db.models.Model), and is the base model class that all my
> models uses.
> I would like to "override" the base model class from django, so everytime
> a developer would import the base model class with "from
> django.db.models import Model", it would insted import my project's custom
> base model.
>
> The result would be something like this:
>
> from django.db import models
>
> class MyModel(models.Model):
> pass
>
>
> >>> type(MyModel)
> 
>
>
> Any help would be apreciated!
>
> --
> 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/649b3b97-17d3-4257-b473-f050440b4d14%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/CAFWa6tJYC3ujmh096Tm9EmfnEixg2Buwa5oRehzMmgLAoUes%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What is the best combination of components when installing Django on Windows 10?

2016-12-28 Thread Avraham Serour
There's nothing recommending not to use uwsgi on windows. Deploying on
windows may be not recommended, but if you must use it uwsgi may be
compiled in cygwin. Actually even nginx may be compiled in cygwin and works
fine

On Wed, Dec 28, 2016 at 5:03 AM, roboslone  wrote:

> Both nginx and Apache are cross-platform, so you could run them on Windows
> as your front-end servers. You can't use gunicorn and it's not recommended
> to use uWSGI on Windows (http://stackoverflow.com/
> questions/21071494/how-to-run-django-with-nginx-on-a-windows-machine),
> but you could still use mod_wsgi with apache. Nginx also has wsgi module.
>
> PostgreSQL, MySQL and sqlite can run on Windows, so you should have no
> problem with DB either.
>
> Personally I would recommend developing on Linux, since you'd probably
> deploy on linux servers eventually. You could rent a VPS or run Ubuntu on
> virtual machine like VirtualBox or VMWare (both supporting Windows as a
> host and many Linux distributions as guest OS), which is free, but could
> slow down your host machine.
>
> As to what's the best combination, I couldn't really tell. Personally I
> use PostgreSQL, gunicorn and nginx.
>
> On 26 Dec 2016, at 09:11, Varuna Seneviratna 
> wrote:
>
> Hello,
>  What is the best combination of components to be used when
> installing Django on Windows 10; By Components, I mean the database and the
> web Server.
>
>
> Thanks, Varuna
>
> --
> 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/CAKW-c0wiaY%3D9viR4r_A3yvNCPSGZbN6W-C5akZ-
> bRLXZgbiDOg%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/667B7DB2-FF63-4928-ACCA-DDDC06CD3403%40gmail.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/CAFWa6t%2Bmwz-YzRsBR5ZV88NzcjHfr_jt0b7w7vB%3DRSpYk6suaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What is the best combination of components to be used with Django on Windows 10?

2016-12-26 Thread Avraham Serour
http://lmgtfy.com/?q=django+deploy+iis


On Mon, Dec 26, 2016 at 8:18 AM, Varuna Seneviratna <
varunasenevira...@gmail.com> wrote:

> What is the best combination of components to be used with Django on
> Windows 10?. By components, I mean the database and the web server.Can
> Django be employed with IIS?
>
> Regards,, Varuna
>
> --
> 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/CAKW-c0wg0YqxiRqVwzhAgAXGVCQwn0wYwt
> gBviigNm8nodsrNg%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/CAFWa6t%2BnSbpoy1btL3uFiOx%2BkDe41LKr0ML0x1PsJ72q_mYHyQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do you recommend to use Hebrew gender-related translations?

2016-12-22 Thread Avraham Serour
maybe translation context?
https://docs.djangoproject.com/en/dev/topics/i18n/translation/#contextual-markers


On Thu, Dec 22, 2016 at 9:29 PM, Fergus Cameron  wrote:

> I personally try to use language agnostic message IDs and translate
> everything (i.e. including English).  Your idea of appending the
> gender is along the same lines and seems logical.
>
> On 22/12/2016, Uri Even-Chen  wrote:
> > Hi Django users,
> >
> > How do you recommend to use Hebrew gender-related translations?
> >
> > For example, here are the choices for diet in Speedy Net (notice it's
> > currently only used in Speedy Match, but it's part of the profile of
> Speedy
> > Net):
> >
> > ```
> > class User(Entity, PermissionsMixin, AbstractBaseUser):
> > 
> > GENDER_FEMALE = 1
> > GENDER_MALE = 2
> > GENDER_OTHER = 3
> > GENDER_CHOICES = (
> > (GENDER_FEMALE, _('Female')),
> > (GENDER_MALE, _('Male')),
> > (GENDER_OTHER, _('Other')),
> > )
> >
> > DIET_UNKNOWN   = 0
> > DIET_VEGAN  = 1
> > DIET_VEGETARIAN = 2
> > DIET_CARNIST= 3
> > DIET_CHOICES = (
> > (DIET_UNKNOWN, _('Please select...')),
> > (DIET_VEGAN, _('Vegan (eats only plants and fungi)')),
> > (DIET_VEGETARIAN, _('Vegetarian (doesn\'t eat fish and meat)')),
> > (DIET_CARNIST, _('Carnist (eats animals)'))
> > )
> > 
> > gender = models.SmallIntegerField(verbose_name=_('I am'),
> > choices=GENDER_CHOICES)
> > diet = models.SmallIntegerField(verbose_name=_('diet'),
> > choices=DIET_CHOICES, default=DIET_UNKNOWN)
> > ```
> >
> > And here are the translations:
> > ```
> > #: .\accounts\models.py:151
> > msgid "Vegan (eats only plants and fungi)"
> > msgstr "טבעוני/ת (אוכל/ת רק צמחים ופטריות)"
> >
> > #: .\accounts\models.py:152
> > msgid "Vegetarian (doesn't eat fish and meat)"
> > msgstr "צמחוני/ת (לא אוכל/ת דגים ובשר)"
> >
> > #: .\accounts\models.py:153
> > msgid "Carnist (eats animals)"
> > msgstr "קרניסט/ית (אוכל/ת חיות)"
> > ```
> >
> > The correct translations in Hebrew are per gender (female, male or other)
> > but in English they are the same. How do you recommend to program it? I
> > thought about adding " [female]", " [male]" or " [other]" suffixes to the
> > strings and then removing them in the English translations. But then
> > English would also require a translation. Is there a better approach? And
> > how do I write the model when this feature is gender-related?
> >
> > The same question is related to any site which has a language where the
> > text is gender-related, and a language where it is not.
> >
> > You can see the code on GitHub: https://github.com/
> urievenchen/speedy-net
> >
> > Thanks,
> > Uri.
> >
> > *Uri Even-Chen*
> > [image: photo] Phone: +972-54-3995700
> > Email: u...@speedy.net
> > Website: http://www.speedysoftware.com/uri/en/
> > 
> > 
> >     <
> http://github.com/urievenchen>
> > 
> >
> > --
> > 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/CAMQ2MsGv_
> fvj6ijM4rb-Y7XfQeGbPJvd38_7o_LYbiukuhxyrg%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/CAHCf7OFGAsD5dAWKOwM535U7ChftJ3LLM9BS2u%3DHPm9Oiued_Q%
> 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/CAFWa6t%2BwK%2BZBGuayQp8RBpfbC%3DE5QtshfJC13ANMdqru9WCENw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django - save user in another table

2016-12-22 Thread Avraham Serour
I think you should create another table called Profile that will hold all
the addtitional info the common users have that the admins do not.
The auth.user table is useful for handling password, authentication,
session and common features all users have.

On Wed, Dec 21, 2016 at 11:45 PM, milad ranaei siadat <
ranaei.mila...@gmail.com> wrote:

> Django - save user in another table
> 
> up vote
> down votefavorite
> 
>
> Is there a way to save my user registration in another table from the
> database?
>
> I don't want to mix AdminUsers with CommonUsers (All the tutorials I've
> seen, they save the registration inside auth_user)
>
> The reasons:
>
>- CommonUsers have different columns and informations
>- CommonUsers can upload content
>- AdminUsers verify the content uploaded by the CommonUsers and make
>sure there is nothing inappropriate
>
> What do I need to use? models? modelform? forms?
>
>
> please help me
>
> --
> 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/e1ae8ddc-a70d-4c76-bdd4-8947871ee1f0%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/CAFWa6tJef6s_p5M0NMmgdy4XkzLc23RXKTAPuGtRKMnNE1P4Vg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Postgres SQL vs SQLite vs MS SQL vs MY SQL

2016-12-22 Thread Avraham Serour
if one really wants to pay for suport you can still use postgres and pay to
enterpriseDB

On Thu, Dec 22, 2016 at 2:45 PM, Sundararajan Seshadri 
wrote:

> The situation justifies the data base. There are more data bases (like
> Oracle and Firebird) than what you have specified. But, let me compare the
> ones you listed. Same observations apply to the other data bases too.
>
> On the first level comparison, you can say SQLITE is excellent for
> productivity during development. It is also free. You can live with it if
> only one or two users are likely to use the system. But if there are more
> users or more entities (or tables), go for 'regular' RDBMS.
>
> If you are ready to pay consistent with the number of users (and get a
> consistent support too!), go for MS SQL. But remember, MS SQL will also
> mean more investment in terms of better hardware. (Note: There is a special
> 'reduced' version of MS SQL which is 'free' can also be used. But remember
> to read the licensing condition)
>
> If you want more than SQLITE but not ready to pay money, go for MySQL or
> Postgre SQL. They are,by nature, without support (except among users, forum
> etc.) but there are companies which offer paid support for these.) Either
> of them is fine and almost they are replaceable by each other. But,
> personally I would vote for Postgrew SQL since this is a little more
> 'corporate' in nature. (Please do not fight with me - I love MYSQL too. The
> comparison is like that between PHP and PYTHON. Again, I love both
> languages!)
>
> I think there was a statement in Django documentation to the effect 'we
> personally love Postgre!'. May be I am wrong?
>
> So back to my original reply: the situation decides what should be used.
>
> Food for thought: there are situations where RDBMS are not the best - and
> they go for 'non-SQL Database'!
>
> 
> ---
>
> On Thursday, December 22, 2016 at 5:10:17 PM UTC+5:30, NoviceSortOf wrote:
>>
>>
>> Curious what advantages if any people are finding working with DBs other
>> than the default SQLLite?
>>
>> We are considering migrating to MSSQL to avoid kinks/ETL involved with
>> having various DB backends for
>> office and server applications, but uncertain the additional cost will be
>> worth it or not.
>>
>>
>> --
> 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/64d650a0-6bc1-4259-8d08-063fbb66c231%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/CAFWa6tJ%2B1suijBMF1rSwjCom_oFQuRsS25fbXdcddxNVS60cCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Postgres SQL vs SQLite vs MS SQL vs MY SQL

2016-12-22 Thread Avraham Serour
I do not want to speak ill of sqlite, it is very useful for development,
testing and other uses, but in short it is not a fully featured DBMS.

Django can work with many different databases, not only sqlite and MSSQL.

You will have license costs for the database and for the OS, I would
personally choose postgres, but it would be valid to use MSSQL if your
organization has no problem paying the license for the ultimate version and
already have an experienced MS DBA with time to worry about the DB for your
application.

What kinds of costs are you worried about?

Avraham

On Thu, Dec 22, 2016 at 1:40 PM, NoviceSortOf 
wrote:

>
> Curious what advantages if any people are finding working with DBs other
> than the default SQLLite?
>
> We are considering migrating to MSSQL to avoid kinks/ETL involved with
> having various DB backends for
> office and server applications, but uncertain the additional cost will be
> worth it or not.
>
>
> --
> 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/42f1c4b9-e75d-4aed-b179-63191b407da0%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/CAFWa6tLYRKxajx2N%3Dq-P7uxD261V_v%3DiQs%2BsqYFnuQYuWBBSWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Criar aquivo urls.py

2016-12-19 Thread Avraham Serour
https://docs.djangoproject.com/en/1.10/intro/tutorial01/#creating-a-project

2016-12-19 23:27 GMT+02:00 Fabio C. Barrionuevo da Luz :

> uai, desde que arquivos python simplesmente são arquivos de texto, abra um
> editor de texto como o Notepad++, Gedit, SublimeTex e crie o arquivo com o
> nome urls.py e coloque dentro dele o código relativo as urls...
>
>
> Talvez você deva explicar melhor quais os problemas que você está tendo
>
> On Mon, Dec 19, 2016 at 5:42 PM, Itamar Junior  wrote:
>
>> Olá galera,
>>
>> sou no django, como posso fazer para criar um arquivo urls.py?
>>
>> Obrigado.
>>
>> --
>> 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/ms
>> gid/django-users/fddd64aa-1c85-41fd-8e5b-ce4d8fd233f9%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Fábio C. Barrionuevo da Luz
> Palmas - Tocantins - Brasil - América do Sul
>
> http://pythonclub.com.br/
>
> Blog colaborativo sobre Python e tecnologias Relacionadas, mantido
> totalmente no https://github.com/pythonclub/pythonclub.github.io .
>
> Todos são livres para publicar. É só fazer fork, escrever sua postagem e
> mandar o pull-request. Leia mais sobre como publicar em README.md e
> contributing.md.
> Regra básica de postagem:
> "Você" acha interessante? É útil para "você"? Pode ser utilizado com
> Python ou é útil para quem usa Python? Está esperando o que? Publica logo,
> que estou louco para ler...
>
> --
> 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/CAPVjvMYjsWBxjfs4waG_iwkbupaRMZcRDqdkmXaQ5uKk%
> 3DapQNw%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/CAFWa6tJuaHGOUqegsAYhwTu1EME%3D4SQ7_Xr0d_7mfCBKUFPbbQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django with MySQL DB for multitenancy

2016-12-19 Thread Avraham Serour
You are right, you may do the routing with nginx but will you have many
isntances of django this way.

You are also right that you should need to create a database router
yourself taking in account whatever is needed to decide which database to
use.
You could for example use the domain from the request to decide which
database to use, but take into account that the database is not the only
thing different from each deploy, the private key for example should be
different, but it would also work if it is the same for everyone.

But if you are using caching for example you should add a preffix, there
are probably more things to take into account but I'm too hungry right now
to think straight.

Good luck
Avraham

On Mon, Dec 19, 2016 at 9:49 AM, Antonis Christofides <
anto...@djangodeployment.com> wrote:

> Hi,
>
> I'm not the expert on that, but since no-one else is replying I'll throw
> my ideas anyway.
>
> One solution that does get rid of the docker containers but doesn't
> otherwise achieve very much is to continue routing from nginx. For one
> client nginx can be connecting to the :8001 backend, for another client
> with :8002, and so on. Now all backends can be running on the same machine
> and use the same virtualenv and project directory, just different settings.
> For example, you might have /etc/mydjangoproject/client1/settings.py,
> /etc/mydjangoproject/client2/settings.py, and likewise have many
> uwsgi/gunicorn instances, each one of them setting PYTHONPATH to a
> different one of these directories so that Django reads the settings from
> there.
>
> The problem with this setup is that it seems like an unnecessary use of
> resources. You will still be running X Django instances when, in theory,
> one should be enough. The benefits are that it will be somewhat simpler
> (since you want be using Docker), and, if you were running many MySQL
> instances (one in each docker), you also save some resources because you
> will be running only one MySQL server (with many databases).
>
> Otherwise, to run a single Django instance, you could define many
> DATABASES and create a database router that selects the appropriate
> database each time. I believe that this is doable with minimal or no
> changes to the application code (only in settings and in a file that
> defines the database router and is imported by settings). But you may also
> need to take care of media files. In FileField, ImageFields, you need to
> specify a callable in upload_to.
>
> Regards,
>
> Antonis Christofideshttp://djangodeployment.com
>
> On 12/16/2016 04:53 PM, Peter Edache wrote:
>
> I basically want to get rid of all the docker containers for each client,
> and just have a single application with many client (as the tenant) and
> mysql databases for each tenant. Just like the way django_tenant_schemas
>  is
> working on postgres sql server.
> Thanks @Antonis Christofides
>
> On Saturday, December 10, 2016 at 4:33:13 PM UTC+1, Antonis Christofides
> wrote:
>>
>> Hi,
>>
>> I don't understand what the problem is. You have a setup that works. What
>> exactly do you want? You want to run many distinct instances of the
>> application on the same server? And you want to get rid of docker?
>>
>> Antonis Christofideshttp://djangodeployment.com
>>
>> On 2016-12-09 17:13, Peter Edache wrote:
>>
>> Hello guys, we are currently looking for a way to migrate our previous
>> django application to a full multi-tenant  application, currently the way
>> we are handling our client is by giving each client a docker container and
>> using nginx to do the routing, through sub-domain mapping.  But after
>> researching i found, lot of article on multitenant using postgres sql but
>> could not find a better approach for MySQL. Can anyone share a solution
>> with me.
>> 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...@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/ms
>> gid/django-users/ff7515e9-5de5-46ef-9490-6a8e49c3c289%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 

Re: Error 500 'NoneType' object

2016-12-14 Thread Avraham Serour
it seems you have a bug on your error handling, it seems messages.error is
None

Can you reproduce this locally? your tests should also cover the error
handling

On Thu, Dec 15, 2016 at 1:45 AM, Zachary Sohovich <
zacharyesohov...@gmail.com> wrote:

> I created a simple contact form with Django for a client. I am using the
> Messages framework to display an error or success message on form
> submission. If the form encounters any errors once or twice, we're good. It
> displays the error message. But, after the third of fourth time there's an
> error, I eventually start getting an Internal Server Error (500).
>
> Here's my *forms.py*
>
> from django import forms
> from captcha.fields import ReCaptchaField
> class EmailForm(forms.Form):
> captcha = ReCaptchaField()
> contact_name = forms.CharField(label='Name',max_length=100,required=
> True,widget=forms.TextInput(attrs={'required':'true'}))
> contact_email = forms.EmailField(required=True,max_length=100,label=
> 'Email',widget=forms.EmailInput(attrs={'required':'true'}))
> content = forms.CharField(required=True,widget=forms.Textarea(attrs={'
> required':'true'}))
>
>
> Here's my *views.py*
>
> from django.shortcuts import render, redirect
> from django.contrib import messages
> from .models import Employee
> from .forms import EmailForm
> from django.core.mail import send_mail
> from django.template import Context
> from django.template.loader import get_template
>
>
> # Create your views here.
>
>
> def home(request):
> return render(request, 'index.html')
>
>
> def team(request):
> members = Employee.objects.all()
> return render(request, 'team.html', {'members':members})
>
>
> def contact(request):
> form_class = EmailForm
> if request.method == 'POST':
> form = EmailForm(request.POST)
> if form.is_valid():
> contact_name = request.POST.get('contact_name', '')
> contact_email = request.POST.get('contact_email', '')
> form_content = request.POST.get('content', '')
> template = get_template('contact_template.txt')
> context = Context({'contact_name':contact_name,'contact_email'
> :contact_email,'form_content':form_content,})
> content = template.render(context)
> send_mail('Website Email from ' + contact_name,content,
> contact_email, ['crowdcont...@sneakycr0w.com'], fail_silently=False)
> messages.success(request,'Email was successful!')
> else:
> try:
> messages.error = messages.error(request, 'There was an
> error submitting your email. Try again.')
> except TypeError:
> messages.error = messages.error(request, 'There was an
> error submitting your email. Try again.')
> return render(request, 'contact.html', {'form': form_class, })
>
>
> And then here's the* trace*:
>
>
>
> Internal Server Error: /contact/
>
> TypeError at /contact/ ‘NoneType’ object is not callable
>
> Request Method: POST Request URL: https://www.crowdcontrolstudios.com/
> contact/
> 
> Django Version: 1.10.4 Python Executable: 
> /home/django/django/crowdcontrol_env/bin/python3
> Python Version: 3.5.2 Python Path: ['/home/django/django',
> ‘/home/django/django/crowdcontrol_env/bin’, ‘/home/django/django/
> crowdcontrol_env/lib/python35.zip’, ‘/home/django/django/
> crowdcontrol_env/lib/python3.5’, ‘/home/django/django/
> crowdcontrol_env/lib/python3.5/plat-x86_64-linux-gnu’,
> ‘/home/django/django/crowdcontrol_env/lib/python3.5/lib-dynload’,
> ‘/usr/lib/python3.5’, ‘/usr/lib/python3.5/plat-x86_64-linux-gnu’,
> ‘/home/django/django/crowdcontrol_env/lib/python3.5/site-packages’]
> Server time: Wed, 14 Dec 2016 23:43:43 + Installed Applications:
> ['static_pages','widget_tweaks',
> 'captcha',
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles']
>
>
> Installed Middleware: ['django.middleware.security.SecurityMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.common.CommonMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'django.middleware.clickjacking.XFrameOptionsMiddleware']
>
>
> Traceback:
>
> File “/home/django/django/static_pages/views.py” in contact33. messages.error
> = messages.error(request, 'There was an error submitting your email. Try
> again.')
>
>
>  During handling of the above exception ('NoneType' 

Re: Opinions on permissions stategy

2016-12-14 Thread Avraham Serour
Hi,

I've given a lot of thought on this, I have also searched for django apps
that deal with permissions, I didn't find something that implements
hierarchical object level permissions, I have a feeling that I am
overcomplicating things if none did this...

Well, first of all I thought of creating a through table for the Object and
user relation, so permission should have a value (how should I name this?
level?)
The idea is that a value of 1 means the user can read and 2 that the user
can write, so to check if a user can read I can compare value>=1
In this way I can also pave the way if I want to implement revoke
permission, which could be value=0

Actually the module would be the root level, so
Module->project->project->project->task->task->task

So a user with permissions to a project has also permissions for its
subprojects and tasks.

What do you mean floor?

mptt seems a very nice solution but...

To check an object permission I would need to get the first ascendent with
permissions registered, with django-mptt I can get all ascendents, this
could be a problem if the object is too deep.
I then would need to loop through the ascendents and check if there are
permissions registered for the current user, this would make yet another
query, the permissions are on another table

Also, I'm not sure how I would list the objects the user can read for
example, opening an project page should list only the tasks and subprojects
the user can read.
Of course if I ca loop all tasks to get the ones the user can read, but
this would be prohibitive slow, how can I do this with django mptt in one
query?

On the other hand the idea of copying the parent permission when an object
is created have cheap reads, not so expensive writes but I'm afraid would
make a too big permissions table (number of users X number of lines for
most tables)

Thanks for the considerations
Avraham


On Tue, Dec 13, 2016 at 3:05 PM, Vinicius Assef <vinicius...@gmail.com>
wrote:

> Yes, mptt can save your day.
>
> When handling hierarchies it's important to establish clear priorities.
>
> An example: given the following hierarchy: Project (1st "floor") -> Module
> (2nd "floor") -> Task (3rd "floor"), if not directly assigned, a task
> should consider module's permission? Or the project's permission should
> always rule that situation?
>
> The object's "floor" is important.
>
> --
> Vinicius
>
>
> On Tuesday, 13 December 2016, Avraham Serour <tovm...@gmail.com> wrote:
>
>> Hi,
>>
>> Thanks for taking your time on this.
>>
>> > Could a child object have a different permission from its parent?
>> Yes, I'm thinking someone may have access to the parent but not to all
>> childs, or read access to the project and write access to some tasks
>> (probably the ones I'm responsible)
>> So each object has
>>
>> >  If it doesn't override the parent permission, you should check the
>> parent's permission, additionally.
>>
>> Well, I see two problems here.
>> 1 - Currently the system stores only who has access, a lack of it means
>> the user has no permission.
>> Not so big of a problem, I can change this, so it is a minor problem.
>>
>> 2 - I don't know the depth level, a task for example may have subtasks,
>> which are task objects itself, which may each have subtasks and so on
>> I would need to check each in a loop, can't do it in one query.
>>
>> I'm now thinking that I could use a mptt for this or maybe this would be
>> too complicated?
>> Using mptt I could have hierarchical permissions and check for
>> permissions on an object and each parent if permissions are not defined,
>> but I would need to change the way permissions are stored right now to also
>> store negative permissions
>>
>> Avraham
>>
>>
>> On Tue, Dec 13, 2016 at 3:34 AM, Vinicius Assef <vinicius...@gmail.com>
>> wrote:
>>
>>> Considerations follow inline...
>>>
>>> On 11 December 2016 at 03:34, Avraham Serour <tovm...@gmail.com> wrote:
>>> > ...
>>> >
>>> > So should I check the parent object permissions? or just checking the
>>> > current object is enough?
>>>
>>> It depends on the granularity level of your permissions.
>>>
>>> Could a child object have a different permission from its parent? If
>>> yes, you only need to check the object itself. If it doesn't override
>>> the parent permission, you should check the parent's permission,
>>> additionally.
>>>
>>> Or must it always obey the parent permissions? If that's the case, you
>>> only need to check the parent permissi

Re: Opinions on permissions stategy

2016-12-12 Thread Avraham Serour
Hi,

Thanks for taking your time on this.

> Could a child object have a different permission from its parent?
Yes, I'm thinking someone may have access to the parent but not to all
childs, or read access to the project and write access to some tasks
(probably the ones I'm responsible)
So each object has

>  If it doesn't override the parent permission, you should check the
parent's permission, additionally.

Well, I see two problems here.
1 - Currently the system stores only who has access, a lack of it means the
user has no permission.
Not so big of a problem, I can change this, so it is a minor problem.

2 - I don't know the depth level, a task for example may have subtasks,
which are task objects itself, which may each have subtasks and so on
I would need to check each in a loop, can't do it in one query.

I'm now thinking that I could use a mptt for this or maybe this would be
too complicated?
Using mptt I could have hierarchical permissions and check for permissions
on an object and each parent if permissions are not defined, but I would
need to change the way permissions are stored right now to also store
negative permissions

Avraham


On Tue, Dec 13, 2016 at 3:34 AM, Vinicius Assef <vinicius...@gmail.com>
wrote:

> Considerations follow inline...
>
> On 11 December 2016 at 03:34, Avraham Serour <tovm...@gmail.com> wrote:
> > ...
> >
> > So should I check the parent object permissions? or just checking the
> > current object is enough?
>
> It depends on the granularity level of your permissions.
>
> Could a child object have a different permission from its parent? If
> yes, you only need to check the object itself. If it doesn't override
> the parent permission, you should check the parent's permission,
> additionally.
>
> Or must it always obey the parent permissions? If that's the case, you
> only need to check the parent permission.
>
> >
> > I'm thinking of copying the parent permissions when an object is
> created, in
> > this way creating an object could be expensive and the permissions table
> may
> > get too big, but reading the permissions can be cheap.
>
> Or children objects can simply point to the parent to check its permission.
>
> You could have a column called `parent_id` in each object. If it is
> the higher level, it will point to nobody (or to itself. It will
> depend on your logic). So, each child will point to the parent.
> Permissions must be checked using `parent_id` for relationship.
>
> But, again, it will depend on the granularity of your permissions and
> how much you want to allow or forbid a child override a parent
> permission.
>
> --
> Vinicius Assef
>
> --
> 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/CAFmXjSDOybmJ0EfBA1ECv9Mf6MFAt
> aEx6%2BrP8XB4x%3D%2BHsOK21Q%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/CAFWa6tK2UFnOwPo_6_VqZSdMnnjV8NxdVfdLsuwvM90OQjifhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Opinions on permissions stategy

2016-12-10 Thread Avraham Serour
Hi,

I'm using DRF and need to implement object based permissions, I
sublassed BasePermission to create my own logic.

Currently all models that make sense to have permission inherits from a
base Object model, implementing common behaviour and fields.

The object has two many to many fields to UserProfile, read_access and
write_access.

So checking if a User has permission to an object is simple as:

base_query = models.Q(pk=user_profile.id)  # base query is for current user
for group in user_profile.get_groups():
base_query |= models.Q(pk=group.id)  # make an OR query for
each group the user belongs
return obj.read_access.filter(base_query).exists()

So checking if a user has permission to a given object can be done cheap in
one query

But the objects in the system have an hierarchy, a Project has tasks which
may have substaks.

So should I check the parent object permissions? or just checking the
current object is enough?

I'm thinking of copying the parent permissions when an object is created,
in this way creating an object could be expensive and the permissions table
may get too big, but reading the permissions can be cheap.

Thoughts? Ideas?

Thanks
Avraham

-- 
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/CAFWa6t%2BL0rtz4ef1w4CLc5TNZLarrPMtg9bZG%3DQWWUdASxeL6g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


  1   2   3   4   5   >