Re: HELP - Writing your first Django app, part 1

2016-10-16 Thread 'Nick Bansal' via Django users
Cheers! got it!

On Friday, 14 October 2016 22:45:05 UTC+1, Asad Jibran Ahmed wrote:
>
> Just save the file inside the *poll *folder. That creates the file.
>
> Asad Jibran Ahmed >
> http://blog.asadjb.com
>
> On Fri, Oct 14, 2016 at 9:55 PM, 'Nick Bansal' via Django users <
> django...@googlegroups.com > wrote:
>
>> I tried to create a new file (im using sublime text) but it just gave me 
>> a new tab...
>>
>> How do I create a new file in an app?
>>
>> On Friday, 14 October 2016 17:41:43 UTC+1, Asad Jibran Ahmed wrote:
>>>
>>> Just create a new file in whatever text editor you're using (I suggest 
>>> Sublime Text if you're looking for options) and save the file as urls.py 
>>> inside the polls directory.
>>>
>>> Asad Jibran Ahmed 
>>> http://blog.asadjb.com
>>>
>>> On Fri, Oct 14, 2016 at 8:00 PM, 'Nick Bansal' via Django users <
>>> django...@googlegroups.com> wrote:
>>>
 Hi, 

 I'm struggling to figure out how to do the following command:

 "To create a URLconf in the polls directory, create a file called 
 urls.py. Your app directory should now look like:"

 How do I create a file called urls.py in the app directory? am I 
 missing something completely obvious?

 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...@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/4ca2fd83-cf96-45d6-9fd1-5721de06247c%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...@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/512287a4-e411-4438-b131-38ab9ffad239%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/2ca2a31e-0994-4107-a6a6-2024a620eec6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: A Backup Model in Django?

2016-10-16 Thread Andromeda Yelton
I've found myself in the situation of needing to copy model data to new
model instances. This rapidly turned into a twisty sort of hell where I was
doing recursion on graphs in order to preserve all the foreign key
references (and then special-casing all the OneToOne fields, because
naively copying those will throw IntegrityErrors right and left...) Now it
is one of those unmaintainable-horror corners of the codebase that no one
wants to go near.

Just back up your whole database. If you're using postgres, pg_dump makes
this really straightforward.

On Sun, Oct 16, 2016 at 2:40 AM, Bernd Wechner 
wrote:

> A curious question I've had trouble finding an answer for alas. I have a
> model that I'd like to backup in the database in a backup model. This being
> the pro-forma so to speqk:
>
> from django.db import models
>
> class MyModel(models.Model):
>  # Declare fields 
>
> class MyModel_backup(MyModel):
>  def create(self):
>   self.objects = MyModel.objects.all()
>
> But there are two immediate problems.
>
>1. Deriving from MyModel reveals itself in the migration to be
>generating a model which has a single OneToOne reference to MyModel. That
>is ti does not appear to create a duplicate model at all. Which leaves me
>wondering how to create a duplicate model without repeating the code.
>
>2. I have no really idea how to copy all the objects of MyModel to a
>new model.
>
> I may be approaching it poorly and am open to better ideas. I'm used to
> doing it in SQL, essentially having an identically defined backup table,
> just copying data to that table before doing a (risky) table wide operation
> on the first.
>
> I could of course export a serialized backup to a disk file, but am
> exploring options for keeping one backup in the database itself.
>
> I'd rather, I admit hear options for doing that than philosophic
> appraisals of the benefits of an in-database copy vs, database exports.
>
> Regards,
>
> Bernd.
>
> --
> 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/a19ba010-572b-4097-a988-f357cc5b6c31%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Andromeda Yelton
Vice President/President-Elect, Library & Information Technology
Association: http://www.lita.org
http://andromedayelton.com
@ThatAndromeda 

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


Re: A Backup Model in Django?

2016-10-16 Thread Vijay Khemlani
For starters, why are you trying to backup a model to the same database
instead of just dumping the whole database?

On Sun, Oct 16, 2016 at 10:02 AM, Andromeda Yelton <
andromeda.yel...@gmail.com> wrote:

> I've found myself in the situation of needing to copy model data to new
> model instances. This rapidly turned into a twisty sort of hell where I was
> doing recursion on graphs in order to preserve all the foreign key
> references (and then special-casing all the OneToOne fields, because
> naively copying those will throw IntegrityErrors right and left...) Now it
> is one of those unmaintainable-horror corners of the codebase that no one
> wants to go near.
>
> Just back up your whole database. If you're using postgres, pg_dump makes
> this really straightforward.
>
> On Sun, Oct 16, 2016 at 2:40 AM, Bernd Wechner 
> wrote:
>
>> A curious question I've had trouble finding an answer for alas. I have a
>> model that I'd like to backup in the database in a backup model. This being
>> the pro-forma so to speqk:
>>
>> from django.db import models
>>
>> class MyModel(models.Model):
>>  # Declare fields 
>>
>> class MyModel_backup(MyModel):
>>  def create(self):
>>   self.objects = MyModel.objects.all()
>>
>> But there are two immediate problems.
>>
>>1. Deriving from MyModel reveals itself in the migration to be
>>generating a model which has a single OneToOne reference to MyModel. That
>>is ti does not appear to create a duplicate model at all. Which leaves me
>>wondering how to create a duplicate model without repeating the code.
>>
>>2. I have no really idea how to copy all the objects of MyModel to a
>>new model.
>>
>> I may be approaching it poorly and am open to better ideas. I'm used to
>> doing it in SQL, essentially having an identically defined backup table,
>> just copying data to that table before doing a (risky) table wide operation
>> on the first.
>>
>> I could of course export a serialized backup to a disk file, but am
>> exploring options for keeping one backup in the database itself.
>>
>> I'd rather, I admit hear options for doing that than philosophic
>> appraisals of the benefits of an in-database copy vs, database exports.
>>
>> Regards,
>>
>> Bernd.
>>
>> --
>> 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/a19ba010-572b-4097-a988-f357cc5b6c31%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Andromeda Yelton
> Vice President/President-Elect, Library & Information Technology
> Association: http://www.lita.org
> http://andromedayelton.com
> @ThatAndromeda 
>
> --
> 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/CAFE1XCYW9cLixRSG2bmBM3Knm0hhf_4q%2BcZvuvvXcDPZmf9nKw%
> 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/CALn3ei00d32BoWERFf3%3DRdb8mNzmmqRiG2P0uRg84G%2BJQucuMQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django Channels

2016-10-16 Thread Amirtpal
Hi Django folks,

Just a couple of questions on using Django Channels

a) Assuming I have remote and distributed clients(e.g. custom code deployed 
inside web applications) and I need that to maintain an asynch flow over 
https to our backend django server in the cloud,
how could I use Django Channels for this above use case ? 
b) If these clients are running inside web applications behind a firewall 
and the only outbound communication is over 80 and 443 via https would 
websockets still work ?
c) Is there a concept of a producer and consumer in django channels ?
d) Any sample code that could be included in remote web applications in 
order to to enable them to communicate in real time via asyn flow with a 
cloud hosted django server ?

Thanks and appreciate your reply.

-Amirtpal

-- 
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/9eecb526-09df-4acc-ba4d-0deead0ccb62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels

2016-10-16 Thread Andrew Godwin
Hi Amirtpal,

a) You would use WebSockets for this purpose. I can't give a summary of how 
they work here - there's plenty of documentation out there about them - but 
they tunnel over HTTP(S) and provide bidirectional communication.

b) If the firewall is just limiting ports, then yes. If there's a weird 
proxy that's capturing all traffic and redirecting it, though, it may block 
WebSockets.

c) I'm not sure what sort of producer and consumer you're talking about, 
but if you read the documentation you'll see that we call the code that 
handles messages on channels consumers. Producer makes no sense as a 
standalone as it's a bidirectional thing not a work queue.

d) There are some examples at 
https://github.com/andrewgodwin/channels-examples, but they're not 
something you can just drop into production; channels is a framework for 
you to build an application on top of, you'll have to write your own Python 
and Javascript around it.

Andrew

On Sunday, October 16, 2016 at 9:43:36 AM UTC-7, Amirtpal wrote:
>
> Hi Django folks,
>
> Just a couple of questions on using Django Channels
>
> a) Assuming I have remote and distributed clients(e.g. custom code 
> deployed inside web applications) and I need that to maintain an asynch 
> flow over https to our backend django server in the cloud,
> how could I use Django Channels for this above use case ? 
> b) If these clients are running inside web applications behind a firewall 
> and the only outbound communication is over 80 and 443 via https would 
> websockets still work ?
> c) Is there a concept of a producer and consumer in django channels ?
> d) Any sample code that could be included in remote web applications in 
> order to to enable them to communicate in real time via asyn flow with a 
> cloud hosted django server ?
>
> Thanks and appreciate your reply.
>
> -Amirtpal
>

-- 
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/f8f4d2be-896b-43b4-b4de-90f4e07abd35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: A Backup Model in Django?

2016-10-16 Thread James Schneider
On Oct 15, 2016 11:40 PM, "Bernd Wechner"  wrote:
>
> A curious question I've had trouble finding an answer for alas. I have a
model that I'd like to backup in the database in a backup model. This being
the pro-forma so to speqk:
>
> from django.db import models
>
> class MyModel(models.Model):
>  # Declare fields 
>
> class MyModel_backup(MyModel):
>  def create(self):
>   self.objects = MyModel.objects.all()
>
> But there are two immediate problems.
> Deriving from MyModel reveals itself in the migration to be generating a
model which has a single OneToOne reference to MyModel. That is ti does not
appear to create a duplicate model at all. Which leaves me wondering how to
create a duplicate model without repeating the code.
>

This one is easy. Create a single abstract model and have both of your
models inherit from there:
https://docs.djangoproject.com/en/1.10/topics/db/models/#abstract-base-classes

This allows you to keep the fields in sync and avoids the extra OneToOne
relationship. The inherited models are completely unrelated and separate
models in separate tables. Note that ForeignKeys will also point to the
same spot, which may or may not be a problem, as others have pointed out.

> I have no really idea how to copy all the objects of MyModel to a new
model.
> I may be approaching it poorly and am open to better ideas. I'm used to
doing it in SQL, essentially having an identically defined backup table,
just copying data to that table before doing a (risky) table wide operation
on the first.
>

Ah, the crux of the issue. Is this something that you perform often? A full
DB backup is always recommended.

Have you considered using transactions? Those were invented for situations
like this.

> I could of course export a serialized backup to a disk file, but am
exploring options for keeping one backup in the database itself.
>

If you go this route, do it with raw SQL. Trying to twist the ORM into
doing this will likely cause headaches, as others have pointed out,
especially with related fields.

> I'd rather, I admit hear options for doing that than philosophic
appraisals of the benefits of an in-database copy vs, database exports.
>

If you're doing this purely as a fail-safe, you're better off using other
methods (ie DB backup and transactions).

If you're doing this for archiving/historical tracking, then you'll want to
manually handle the process of copying the models anyway. There are
multiple strategies.

For instance, using an abstract model as the master, in your backup model
you can override the __init__() method to take an instance of your primary
model as an argument and copy all of the fields, and handle the foreign
keys appropriately. It could be as simple as providing a list of fields to
copy and praying through the primary object to copy them to the backup
object.

There are a few packages that you might be able to take advantage of or use
as reference:

https://github.com/etianen/django-reversion
https://github.com/treyhunner/django-simple-history

I'm sure others exist, this was a quick Google. I don't believe these copy
the models as you desired, though (because it is difficult/impossible to do
without intimate knowledge of the model you are copying for anything beyond
a strict copy).

-James

-- 
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%2Be%2BciVTYxHOOyqN3Zn0VSFrK-spBBWsKQsJqLJ11qvTRJ%2BuSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: A Backup Model in Django?

2016-10-16 Thread Mike Dewhirst

On 17/10/2016 9:11 AM, James Schneider wrote:


On Oct 15, 2016 11:40 PM, "Bernd Wechner" > wrote:

>
> A curious question I've had trouble finding an answer for alas. I 
have a model that I'd like to backup in the database in a backup model.




This reminded me of a section in Marty Allchin's Pro Django - Keeping 
History Records


https://books.google.com.au/books?id=cpAV4bb1nYYC&pg=PA263&lpg=PA263&dq=pro+django+keeping+historical+records&source=bl&ots=1NLYKkRZzR&sig=QogOv-Kg6EReaBkcHaAwJA-vWKY&hl=en&sa=X&ved=0ahUKEwil5vDrr-DPAhVJKWMKHTzYDAoQ6AEIKTAC#v=onepage&q=pro%20django%20keeping%20historical%20records&f=false

If the notions suit your use-case you need to remember it was written 
for Django 1.0 and Python >= 2.3. It may contain traces of 
long-deprecated features but the principles are timeless.


Good luck

Mike


This being the pro-forma so to speqk:
>
> from django.db import models
>
> class MyModel(models.Model):
> Â # Declare fields 
>
> class MyModel_backup(MyModel):
> Â def create(self):
> Â  self.objects = MyModel.objects.all()
> Â
> But there are two immediate problems.
> Deriving from MyModel reveals itself in the migration to be 
generating a model which has a single OneToOne reference to MyModel. 
That is ti does not appear to create a duplicate model at all. Which 
leaves me wondering how to create a duplicate model without repeating 
the code.Â

>

This one is easy. Create a single abstract model and have both of your 
models inherit from 
there:https://docs.djangoproject.com/en/1.10/topics/db/models/#abstract-base-classes


This allows you to keep the fields in sync and avoids the extra 
OneToOne relationship. The inherited models are completely unrelated 
and separate models in separate tables. Note that ForeignKeys will 
also point to the same spot, which may or may not be a problem, as 
others have pointed out.


> I have no really idea how to copy all the objects of MyModel to a 
new model.
> I may be approaching it poorly and am open to better ideas. I'm used 
to doing it in SQL, essentially having an identically defined backup 
table, just copying data to that table before doing a (risky) table 
wide operation on the first.Â

>

Ah, the crux of the issue. Is this something that you perform often? A 
full DB backup is always recommended.


Have you considered using transactions? Those were invented for 
situations like this.


> I could of course export a serialized backup to a disk file, but am 
exploring options for keeping one backup in the database itself.Â

>

If you go this route, do it with raw SQL. Trying to twist the ORM into 
doing this will likely cause headaches, as others have pointed out, 
especially with related fields.


> I'd rather, I admit hear options for doing that than philosophic 
appraisals of the benefits of an in-database copy vs, database exports.Â

>

If you're doing this purely as a fail-safe, you're better off using 
other methods (ie DB backup and transactions).


If you're doing this for archiving/historical tracking, then you'll 
want to manually handle the process of copying the models anyway. 
There are multiple strategies.


For instance, using an abstract model as the master, in your backup 
model you can override the __init__() method to take an instance of 
your primary model as an argument and copy all of the fields, and 
handle the foreign keys appropriately. It could be as simple as 
providing a list of fields to copy and praying through the primary 
object to copy them to the backup object.


There are a few packages that you might be able to take advantage of 
or use as reference:


https://github.com/etianen/django-reversion
https://github.com/treyhunner/django-simple-history

I'm sure others exist, this was a quick Google. I don't believe these 
copy the models as you desired, though (because it is 
difficult/impossible to do without intimate knowledge of the model you 
are copying for anything beyond a strict copy).


-James

--
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%2Be%2BciVTYxHOOyqN3Zn0VSFrK-spBBWsKQsJqLJ11qvTRJ%2BuSA%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 receiv

Re: Django and Lynda.com

2016-10-16 Thread James Schneider
On Fri, Oct 14, 2016 at 6:53 PM, Paul Handley 
wrote:

> I figured it out. For some reason the presenter did not add the name of
> the app at the end of the makemigrations command. I did exactly like he did
> and got the wrong result. When I added the name of the app at the end
> everything functioned normally. With Jayne.com you are flying blind. There
> is no one to help you understand if the presenter makes a mistake. I'm
> looking around fr another site that is more user-friendly. Thanks a lot for
> your help!
>
>
I can certainly tell you that adding the app name should not be necessary
in most cases, especially on a starter project.

I looked briefly at lynda.com. There are two different Django tutorials.
I'm assuming you viewed the more basic of the two (Up and Running with
Python and Django, Smith). I watched the sections on creating models and
migrations, and the only piece that I saw was confusing was changing the
app name part way through the tutorial, which requires changes in a couple
of other places. I didn't go through the tutorial entirely, though.

I'm not entirely sure what happened, but I can assure you that the app name
should not be necessary assuming that everything else is correct. I've
never had to enter the app name. Doing so will limit your migration
creation to the specific app, which will likely lead to issues down the
road if you have multiple apps.

-James

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


Re: Multiple instances of a Django application operating on different data

2016-10-16 Thread James Schneider
On Sat, Oct 8, 2016 at 2:52 AM, hans.krebs42  wrote:

> I'm coding a Django web project. I've created an app and implemented its
> functionality - templates, models etc. The website needs to use this
> application in two places, and the only difference are the sets of data the
> instances will be operating on (for example, say it's a news app and I have
> two unrelated sections of the site, each needs to display news concerning
> completely different topics). Is there a clean (i.e. other than just
> copying all the code into another directory) way to achieve this in Django?
> Ideally I'd like to use one database and split the data into separate
> tables.
>

Why do you need separate Django instances for this? Are the two instances
meant to stand out on their own as well as provide common content?

If I understand your requirements correctly, it sounds like all you need is
a separate set of models that both inherit from the same abstract master
model (to achieve table separation with the same fields). The only
difference between your views would be the referenced model and the URL
(which controls which set of views that are called). If you use CBV's, then
you can likely write one view that does all the work, and a second view
that inherits from it, only changing the reference model.

If it were me, I would try to combine all of the articles down into a
single table, and filter the articles for each section of the site by tags
or categories. That would be way easier to keep track of, even when taking
advantage of the inheritance in the models and views.

You may also be able to take advantage of the sites framework, but I'm not
sure if that achieves what you want (intended for separate databases),
however, you could have both instances point at the same database and have
a different reference model listed in your settings.py that your views will
use. You may have other issues with doing that (most likely with
authentication), but it would be something to look into.

https://docs.djangoproject.com/en/1.10/ref/contrib/sites/

-James

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


Re: Django Channels

2016-10-16 Thread Amirtpal
Thanks Andrew,

-Amirtpal

On Monday, October 17, 2016 at 1:27:53 AM UTC+8, Andrew Godwin wrote:
>
> Hi Amirtpal,
>
> a) You would use WebSockets for this purpose. I can't give a summary of 
> how they work here - there's plenty of documentation out there about them - 
> but they tunnel over HTTP(S) and provide bidirectional communication.
>
> b) If the firewall is just limiting ports, then yes. If there's a weird 
> proxy that's capturing all traffic and redirecting it, though, it may block 
> WebSockets.
>
> c) I'm not sure what sort of producer and consumer you're talking about, 
> but if you read the documentation you'll see that we call the code that 
> handles messages on channels consumers. Producer makes no sense as a 
> standalone as it's a bidirectional thing not a work queue.
>
> d) There are some examples at 
> https://github.com/andrewgodwin/channels-examples, but they're not 
> something you can just drop into production; channels is a framework for 
> you to build an application on top of, you'll have to write your own Python 
> and Javascript around it.
>
> Andrew
>
> On Sunday, October 16, 2016 at 9:43:36 AM UTC-7, Amirtpal wrote:
>>
>> Hi Django folks,
>>
>> Just a couple of questions on using Django Channels
>>
>> a) Assuming I have remote and distributed clients(e.g. custom code 
>> deployed inside web applications) and I need that to maintain an asynch 
>> flow over https to our backend django server in the cloud,
>> how could I use Django Channels for this above use case ? 
>> b) If these clients are running inside web applications behind a firewall 
>> and the only outbound communication is over 80 and 443 via https would 
>> websockets still work ?
>> c) Is there a concept of a producer and consumer in django channels ?
>> d) Any sample code that could be included in remote web applications in 
>> order to to enable them to communicate in real time via asyn flow with a 
>> cloud hosted django server ?
>>
>> Thanks and appreciate your reply.
>>
>> -Amirtpal
>>
>

-- 
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/b650edf4-aa0f-49fe-ac37-cfd8671913be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Custom Admin Command

2016-10-16 Thread Mario R. Osorio
I am trying to implement a custom admin command. The class is located at 
mt_project/my_app/management/command/my_command
and looks like this:

 

class Command(BaseCommand):

help = 'This is my command'


def handle(self, *args, **options):

...



My app is included in Installed_apps. I think I've covered all documented 
requirements yet; the command is just NOT available. manage.py tells me it 
is un "Unknown command"

What am I doing wrong?

Thanks a lot in advanced!

-- 
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/f77931ca-39f6-4678-8670-316fc0f2e0a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom Admin Command

2016-10-16 Thread Mario R. Osorio

By the way, there are *__init__.py* files in 
both my_project/my_app/management/ and my_project/my_app/management/command 
folders ...


On Sunday, October 16, 2016 at 9:58:25 PM UTC-4, Mario R. Osorio wrote:
>
> I am trying to implement a custom admin command. The class is located at 
> mt_project/my_app/management/command/my_command
> and looks like this:
>
>  
>
> class Command(BaseCommand):
>
> help = 'This is my command'
>
>
> def handle(self, *args, **options):
>
> ...
>
>
>
> My app is included in Installed_apps. I think I've covered all documented 
> requirements yet; the command is just NOT available. manage.py tells me it 
> is un "Unknown command"
>
> What am I doing wrong?
>
> Thanks a lot in advanced!
>
>

-- 
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/f679ba2c-cc77-41c6-a1b3-39e9482d5a61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom Admin Command

2016-10-16 Thread Dylan Reinhold
Is your my_command file named my_command.py?

how are you calling it `manage.py my_command`?

Dylan

On Sun, Oct 16, 2016 at 7:04 PM, Mario R. Osorio 
wrote:

>
> By the way, there are *__init__.py* files in both 
> my_project/my_app/management/
> and my_project/my_app/management/command folders ...
>
>
> On Sunday, October 16, 2016 at 9:58:25 PM UTC-4, Mario R. Osorio wrote:
>>
>> I am trying to implement a custom admin command. The class is located at
>> mt_project/my_app/management/command/my_command
>> and looks like this:
>>
>>
>>
>> class Command(BaseCommand):
>>
>> help = 'This is my command'
>>
>>
>> def handle(self, *args, **options):
>>
>> ...
>>
>>
>>
>> My app is included in Installed_apps. I think I've covered all documented
>> requirements yet; the command is just NOT available. manage.py tells me it
>> is un "Unknown command"
>>
>> What am I doing wrong?
>>
>> Thanks a lot in advanced!
>>
>> --
> 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/f679ba2c-cc77-41c6-a1b3-39e9482d5a61%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/CAHtg44B3%2BuGFj446pYKbHfzPHB1K_3WUiTWa2DO0KgxQ66WjXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom Admin Command

2016-10-16 Thread Mario R. Osorio
Thanks a lot for your help Dylan,

Right after writing I noticed my mistake, I was naming the folder
my_app/management/command

I renamed it my_app/management/commands and voila!.

it worked like a charm.


Dtb/Gby
===
Mario R. Osorio
A.S. of Computer Programming and Analysis
Web page: *http;//mario.osorio.solutions
*
Email: *mario@osorio.solutions* 
*Just Choose Python!* 

“If I had asked people what they wanted, they would have said faster
horses.”
 ― Henry Ford







On Sun, Oct 16, 2016 at 10:27 PM, Dylan Reinhold 
wrote:

> Is your my_command file named my_command.py?
>
> how are you calling it `manage.py my_command`?
>
> Dylan
>
> On Sun, Oct 16, 2016 at 7:04 PM, Mario R. Osorio 
> wrote:
>
>>
>> By the way, there are *__init__.py* files in
>> both my_project/my_app/management/ and my_project/my_app/management/command
>> folders ...
>>
>>
>> On Sunday, October 16, 2016 at 9:58:25 PM UTC-4, Mario R. Osorio wrote:
>>>
>>> I am trying to implement a custom admin command. The class is located at
>>> mt_project/my_app/management/command/my_command
>>> and looks like this:
>>>
>>>
>>>
>>> class Command(BaseCommand):
>>>
>>> help = 'This is my command'
>>>
>>>
>>> def handle(self, *args, **options):
>>>
>>> ...
>>>
>>>
>>>
>>> My app is included in Installed_apps. I think I've covered all
>>> documented requirements yet; the command is just NOT available. manage.py
>>> tells me it is un "Unknown command"
>>>
>>> What am I doing wrong?
>>>
>>> Thanks a lot in advanced!
>>>
>>> --
>> 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/f679ba2c-cc77-41c6-a1b3-39e9482d5a61%40googlegroups.com
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/1PuWQKwfRcU/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAHtg44B3%2BuGFj446pYKbHfzPHB1K_
> 3WUiTWa2DO0KgxQ66WjXg%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/CAO2PNV7QJa_BwHD5UTSxRSNfuHh7vQef74C7ctFDUxV5uphOeA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.