Re: dja...@googlegroups.com

2021-11-29 Thread Benjamin Schollnick
Why would you need to use blockchain technology, other than to simply check a 
checkbox and use a buzz word?

- Benjamin



> On Nov 29, 2021, at 1:37 AM, Bernard Mallala  wrote:
> 
> This is a very open ended comment but I will take a stab at it.
> To build a blood bank management solution, you will need to dabble in supply 
> chain and leverage blockchain to uniquely track each transfusion through the 
> supply chain, to the bank and delivery to the recipient vein.
> This is a big and expensive endeavor and I would recommend building such as 
> solution only if you have a paying customer or strategic partner.
> For reference, IBM has such a solution for their clients, Canada's blood 
> system is another good example, and various ministries of health also 
> leverage similar systems. Not all countries have such and there is 
> opportunity and need. Research "vein to vein" to learn more.
> 
> On Sunday, November 28, 2021 at 9:20:49 AM UTC-7 asghedom...@gmail.com wrote:
> i want to develop blood bank management system in django what can you 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/5632ef97-8761-49c3-bc01-61981a6cccacn%40googlegroups.com
>  
> .

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/858EA238-307C-40B8-BE24-2785910E6A13%40schollnick.net.


Re: Django SMS project

2022-05-22 Thread Benjamin Schollnick
> Hi guys I have a project of django to send SMS to mobile number,
> Please guys I really need your helps

Well, that’s fine, but what help are you looking for?

- Benjamin


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

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/FBAD2B03-F5E6-4FCC-BBC4-70DC59795E15%40schollnick.net.


Re: Resolving my display

2022-12-15 Thread Benjamin Schollnick
> Good day, i'm just beginning to learn django. Kindly help resolve this error.

What error are you experiencing, since there’s no obvious issue in the screen 
capture that I see?

- Benjamin


>  
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/84ae5f37-3689-4d31-85af-a518953fedean%40googlegroups.com
>  
> .
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0323E798-2341-4DDB-9299-90BCDFBCE449%40schollnick.net.


Re: objects.create only pupulate few fileds and when called again it populate all the fiedls in DB

2022-12-15 Thread Benjamin Schollnick
> When I create an object of model and assign few values to it then the objects 
> get created but only few values get populated but again if I get the created 
> object and assign the values it get populated this time
> 
> Anyone have any idea why it is happening

Generally speaking this is probably a coding logic error.  The ORM doesn’t pick 
and chose fields at random to update or save, it saves the fields that you 
specify in your code.

Without seeing the code, it’s hard to give any specifics.

But generally make sure that your values are completely set before you call for 
a save.

- Benjamin


> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/9d531041-fc01-4c85-8dd5-53da116ffe8an%40googlegroups.com
>  
> .

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7905B592-4EAE-4258-8B14-CD5F2A274B73%40schollnick.net.


Re: Need help Scraping a couple of websites

2022-12-23 Thread Benjamin Schollnick
> I can scrap for you. I just created an IMDB scrapper(which is illegal, so not 
> going to post the code anywhere but mailed IMDb about it) in the flask.
> Also, have experience in Django and web scrapping using bs4.

illegal?  Against Copyright, and maybe not permitted by End-User License.  

But illegal?  You’re not going to go to jail if you scrape IMDB, as an 
individual user.  If you do it as part of a company, that company will probably 
be issued a cease and desist…  And if they don’t comply they’ll get IP blocked, 
and possibly sued.  But once again, I suspect that would be civil, and maybe 
not criminal?  I’m not sure… 

But IMDB can’t do anything to prevent someone from scraping the web site, as a 
individual, as long as you don’t draw attention to yourself.

- Benjamin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/914A19F5-E2B4-41B8-9E3F-73C3A272FAF5%40schollnick.net.


Re: Newtwork Marketing System

2023-06-15 Thread Benjamin Schollnick
> Hi Everyone!
> So I want to know how to implement a binary tree to a web app.
> This is how the app works:
> 
> —  Person A opens an account
> —  Person A refers to people
> — Person B invests,
> — Person A get 10% of Person B's investment 
> So it goes on iteratively.

Please note, nothing here in your description needs (or begs) to be a binary 
tree.

Have a referred field in the person table, which points to the PK of the person 
that referred them.

Then you just do a filter on that persons referred field PK to find out who 
referred them.

Yes, a binary tree is suppose to be one of the faster searches for certain 
types of data…But as described I’m not sure it’s a good fit.

- Benjamin


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/96D0264D-3922-4376-8334-7D11CFFA9456%40schollnick.net.


Issue with Django migrate - fine with 2.7x python, but error with 3.6.4?

2018-05-23 Thread Benjamin Schollnick
I've an established Django application that I'm finishing up a new release 
for, and I'm working on solving any last python 3 issues.

I'm confused at what's happening here though...

Run manage.py migrations under v2.7x:

nerv:quickbbs Benjamin$ manage.py migrate --run-syncdb

Running on nerv.local

Operations to perform:

  Synchronize unmigrated apps: _humanize, allauth, bootstrap3, 
django_jinja, grappelli, humanize, messages, staticfiles

  Apply all migrations: account, admin, auth, contenttypes, quickbbs, 
sessions, sites, socialaccount

Synchronizing apps without migrations:

  Creating tables...

Running deferred SQL...

Running migrations:

  No migrations to apply.


Run manage.py migrations under v3.65.

(quickbbs) nerv:quickbbs Benjamin$ python3 manage.py migrate

Running on nerv.local

CommandError: Conflicting migrations detected; multiple leaf nodes in the 
migration graph: (0019_auto_20171108_0155, 0044_auto_20180519_1914 in 
quickbbs).

To fix them run 'python manage.py makemigrations --merge'

(quickbbs) nerv:quickbbs Benjamin$ 

Okay?  

Manage.py makemigrations --merge

(quickbbs) nerv:quickbbs Benjamin$ python3 manage.py makemigrations --merge

Running on nerv.local

Traceback (most recent call last):

  File "manage.py", line 10, in 

execute_from_command_line(sys.argv)

  File 
"/Users/Benjamin/django-py3/quickbbs/lib/python3.6/site-packages/django/core/management/__init__.py",
 
line 371, in execute_from_command_line

utility.execute()

  File 
"/Users/Benjamin/django-py3/quickbbs/lib/python3.6/site-packages/django/core/management/__init__.py",
 
line 365, in execute

self.fetch_command(subcommand).run_from_argv(self.argv)

  File 
"/Users/Benjamin/django-py3/quickbbs/lib/python3.6/site-packages/django/core/management/base.py",
 
line 288, in run_from_argv

self.execute(*args, **cmd_options)

  File 
"/Users/Benjamin/django-py3/quickbbs/lib/python3.6/site-packages/django/core/management/base.py",
 
line 335, in execute

output = self.handle(*args, **options)

  File 
"/Users/Benjamin/django-py3/quickbbs/lib/python3.6/site-packages/django/core/management/commands/makemigrations.py",
 
line 124, in handle

return self.handle_merge(loader, conflicts)

  File 
"/Users/Benjamin/django-py3/quickbbs/lib/python3.6/site-packages/django/core/management/commands/makemigrations.py",
 
line 251, in handle_merge

raise ValueError("Could not find common ancestor of %s" % 
migration_names)

ValueError: Could not find common ancestor of {'0019_auto_20171108_0155', 
'0044_auto_20180519_1914'}


I have found several other people reporting similar issues, but I don't see 
any best practices to prevent this, and no straight forward explanations on 
how to fix this?


But my big question is why is this happening with Py3, and not Py2?  


- Benjamin




-- 
You received this message because you are subscribed 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/2fca9e9d-09a2-4d6e-b9ba-578db6bbf404%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Issue with Django migrate - fine with 2.7x python, but error with 3.6.4?

2018-05-23 Thread Benjamin Schollnick


> Not convinced yet this is a py2 versus py3 problem. First, you're running 
> different command flags (though, not sure it matters in this case). 
> Second, the 
> Django version for py3 can be different from the py2 version. 
>
> From the backtrace it isn't clear though which app is causing this. If it 
> really is a py2 versus py3 issue, then I suspect that some migrations are 
> done 
> only for py3, though that is really bad practice. 
>

Well, all migrations were made using makemigrations,  so if there are any 
specific PY2 vs PY3 differences, I'm unaware of any...

I've looked, and I don't have any clue on how to manually merge these 
because there are two 0018's, with different timestamps, and I don't want 
to break anything further.

Would it be simpler to reset the migrations using the current database 
state as the base?  Is there a way to do this?  After all, it's working 
fine... with both versions of django.
This seems to be more of a false positive then anything else?

Or maybe squash the migrations?  Is there a good guide to squashing?

   - Benjamin


-- 
You received this message because you are subscribed 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/00c11f2d-c571-49c7-a9a3-4eef6ed0f814%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Issue with Django migrate - fine with 2.7x python, but error with 3.6.4?

2018-05-23 Thread Benjamin Schollnick
Okay, squashing seems to have resolved this issue...

Seems a bit voodoo-ish, but it worked.  Any suggestions for preventing this 
in the future would be nice!

   - Benjamin



On Wednesday, May 23, 2018 at 6:04:47 PM UTC-4, Benjamin Schollnick wrote:
>
>
> Not convinced yet this is a py2 versus py3 problem. First, you're running 
>> different command flags (though, not sure it matters in this case). 
>> Second, the 
>> Django version for py3 can be different from the py2 version. 
>>
>> From the backtrace it isn't clear though which app is causing this. If it 
>> really is a py2 versus py3 issue, then I suspect that some migrations are 
>> done 
>> only for py3, though that is really bad practice. 
>>
>
> Well, all migrations were made using makemigrations,  so if there are any 
> specific PY2 vs PY3 differences, I'm unaware of any...
>
> I've looked, and I don't have any clue on how to manually merge these 
> because there are two 0018's, with different timestamps, and I don't want 
> to break anything further.
>
> Would it be simpler to reset the migrations using the current database 
> state as the base?  Is there a way to do this?  After all, it's working 
> fine... with both versions of django.
> This seems to be more of a false positive then anything else?
>
> Or maybe squash the migrations?  Is there a good guide to squashing?
>
>- Benjamin
>
>
>

-- 
You received this message because you are subscribed 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/c834f175-22a0-42c2-b8f2-69d00e2351d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Issue with Django migrate - fine with 2.7x python, but error with 3.6.4?

2018-05-24 Thread Benjamin Schollnick
Melvyn,

First, I'm sorry if this come off a bit snarky, it's been a long day...  
I want to say Thank you for your assistance, and I appreciate the help, 
even though I took potentially the easy way out...

But squashing the migrations, made me realize that the root cause, may have 
been an earlier squashed migration that wasn't cleaned up properly.

Was it?  I'm not sure, but after squashing and cleaning, it did clear up.

> Okay, squashing seems to have resolved this issue... 
>
> Did you find any issues with the documentation on squashing? 
>

Sadly, yes.  

1) Finding it
   For example:

There are several commands which you will use to 
interact with migrations and Django’s handling of database schema:

   - migrate 
 
, 
 which is responsible for applying and unapplying migrations.
 - makemigrations 
 
,
 
 which is responsible for creating new migrations based on the changes 
you 
 have made to your models.
 - sqlmigrate 
 
,
 
 which displays the SQL statements for a migration.
 - showmigrations 
 
,
 
 which lists a project’s migrations and their status.
  
   Squashing isn't even listed in the Beginning discussion? 
 It's a command, isn't it?
   I had to search the web page to find it.  

Overall, 

> Seems a bit voodoo-ish, but it worked.  Any suggestions for preventing 
> this 
> > in the future would be nice! 
>
> It's voodoo-ish cause you stopped analyzing the problem and went for the 
> work- 
> around. 
>

Sure, I'll accept that.  I disagree that staring at two different 0018 
files, which don't give me much to work from.  But the work around actually 
made me realize what happened to cause this in the first place...  Feel 
free to take a look at the migrations

# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-08 01:49
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('quickbbs', '0017_auto_20171107_1415'),
]

operations = [
migrations.CreateModel(
name='IndexData',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('LastScan', models.FloatField(db_index=True)),
('LastMod', models.FloatField(db_index=True)),
('Name', models.CharField(db_index=True, default=None, 
max_length=512)),
('SortName', models.CharField(db_index=True, default='', 
editable=False, max_length=512)),
('Size', models.IntegerField(default=0)),
('FQPNDirectory', models.CharField(db_index=True, 
default=0, max_length=512)),
('ParentDirID', models.IntegerField(default=0)),
('is_dir', models.BooleanField(db_index=True, 
default=False)),
('is_pdf', models.BooleanField(db_index=True, 
default=False)),
('is_archive', models.BooleanField(db_index=True, 
default=False)),
('Ignore', models.BooleanField(default=False)),
('DeletePending', models.BooleanField(default=False)),
],
),
migrations.DeleteModel(
name='DirData',
),
migrations.DeleteModel(
name='FileData',
),

]

vs 

#-*- coding: utf-8 -*-
#Generated by Django 1.11.9 on 2018-03-15 21:47
from __future__ import unicode_literals

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('quickbbs', '0017_auto_20180315_2138'),
]

operations = [
migrations.RemoveField(
model_name='thumbnails_files',
name='DeletePending',
),
migrations.RemoveField(
model_name='thumbnails_files',
name='Flag_For_Regeneration',
),
]
 

>
> So my best guess is: 
> - The two 0018 migrations were caused by 2 different branches in the 
> source repository, adding migrations in parallel 
>

You're guessing, but that's because you don't have the details.. (And that 
is my fault).

One, I'm the only one working on this  - 
http://github.com/bschollnick/quickbbs
And no, sadly there has only been one active tree in development.  
 

> - These were applied to the database also in parallel 
> - Further migrations were added, depending on the 0018 migrations 
> - One migration was removed that was the common ancenstor for one of the 
> 0018 
> migrations and another migration. 
>

Actually, because of the workaround, I realized that an ear

SHA-512 in django model? Optimization help?

2019-04-07 Thread Benjamin Schollnick
Right now, I’m generating a SHA-512 of a file in my Django model, but that 
requires a string of 128 bytes…

I’m not positive on a better way to store the sha-512 in my model?  Can 
anyone suggest a method / design that would be better optimized?

A quick test, looks like I might be able to store this in a blob of 64 
bytes, which would be a considerable savings…

t = hashlib.sha512(test.encode("utf-16”))
digest = t.digest()
len(digest)
64

t = hashlib.sha512(test.encode("utf-16”))
hexdigest = t.hexdigest()
len(hexdigest)
128

But thinking about it, I could convert the hex digest to an integer?

int(hexdigest,16)
4298666745768817459166789395753510504053621749752930724783367173454957154660445390018210346619930005782627382250329880502243093184532984814018267510704707
z = int(hexdigest,16)
type(z)



‘52137203c3c4b62bc981fd9c8770952bfd1984ee9ce6e33ec94e485bc31a5631b6c6d15c1a2646f39c887575b576e66ed1ddbd96112d5355e574f06df8878a43'
0x52137203c3c4b62bc981fd9c8770952bfd1984ee9ce6e33ec94e485bc31a5631b6c6d15c1a2646f39c887575b576e66ed1ddbd96112d5355e574f06df8878a43

They convert identically, but I’m not sure that converting to integer would 
keep the integrity of the sha-512?

Can anyone make any sort of suggestion on the best way to handle this?

- Benjamin

-- 
You received this message because you are subscribed 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/61a7c17c-7c23-49ca-9cdb-0df325672ed5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: SHA-512 in django model? Optimization help?

2019-04-08 Thread Benjamin Schollnick


> Something I forgot to mention earlier: If the files are not too big, 
> consider generating the SHA-512 on the fly instead of storing it. 
> Space-wise, it is the best possible optimization, obviously. And it 
> frees you from having to ensure consistency between the file and the hash. 
>

We're using MS SQL server...  

But we're using the SHA-512 to validate file integrity through a multistage 
process.  So, we need to have the SHA for certain steps of the process.
(eg. Ingress, Conversion, Output) so that we can validate it's the same 
file we received, etc.

The issue I am having is that the sheer size of this database, is making 
every byte count...  (40+ million records)
And disk space is a cost, which I am trying to work around... 

-- 
You received this message because you are subscribed 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/0e6af7e7-55aa-41c4-99a4-13c27c98f293%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Looking for a solution? Calculating index/offset of a particular record?

2020-05-27 Thread Benjamin Schollnick
I’m trying to optimize a few different things.

I am looking to try to change this into a more database driven routine, instead 
of having to iterate through each and every record.  While not time consuming 
(overall), I would like to try to make it a bit cleaner…

Effectively I am calculating which record the user is actually looking at in 
the gallery.  The UUID is based into the view, and the view then has to figure 
out it’s image XX out of YYY.

 for counter, data in enumerate(catalog_qs, start=1):
 if str(data.uuid) == e_uuid:
 context["page"] = counter
 break

I generalized it to this:

def return_offset_uuid(sorder, fpath, tuuid):
"""
Fetch specific database values only from the database
"""
entries = 
index_data.objects.exclude(ignore=True).exclude(delete_pending=True).filter(
fqpndirectory=fpath.lower().strip()).order_by(*SORT_MATRIX[sorder])
tpk = entries.filter(uuid=tuuid.strip())[0].pk
count = entries.filter(pk__lte=tpk).count() - 1
#answer = user.answer_set.filter(question=question).get()
# return user.answer_set.filter(pk__lte=answer.pk).count() - 1
return count


Which *seemed* to work, except it didn’t.  Yes, I got results:

>>> return_offset_uuid(0, album, "c0543ce7-d156-430d-b08a-5f7379b6e246")# 1
1
>>> return_offset_uuid(0, album, "519f5b9c-e4f4-44e1-aa82-f36aed98e6a9")# 31
4905
>>> return_offset_uuid(0, album, "754fcb51-c3ad-417d-b317-b86305597ae9")# 61
5044
>>> return_offset_uuid(0, album, "b85f18e0-aa17-4192-9c0f-a363d82fa127")# 91
81
>>> return_offset_uuid(0, album, "fe750266-5fb6-467a-929e-c752fa2091ac")  # 
>>> 121
108
>>> return_offset_uuid(0, album, "51d5ea79-1859-402b-85ff-ae3b2adf7173")  # 
>>> 5535
4885

Looking at it, entry “.jpg” is added, it’ll have a larger PK than “ZZZ.jpg” 
which was added two months ago.

Is there a better way to do this?  I’ll keep the for loop if I have to…

- Benjamin


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9D43C117-B6EF-4CAD-897C-725C02C67129%40schollnick.net.


Re: transforming form input

2020-07-08 Thread Benjamin Schollnick
What I generally do is use https://pypi.org/project/nameparser/

While Clive is correct, I haven’t seen name parser fail at breaking it apart 
correct so far.

- Benjamin



> On Jul 8, 2020, at 6:43 PM, Clive Bruton  wrote:
> 
> 
> On 7 Jul 2020, at 22:58, Kai Kobschätzki wrote:
> 
>> I render one input field surname. And if the user writes one string in
>> the input field it should be saved to surname (so forename is None). If
>> the user writes two strings (separated through a white space) than the
>> first part should be saved to forename and the second one to surname
>> (and perhaps I want to make some string manipulation further).
> 
> This isn't a "safe" way of delineating forename/surname. It isn't that 
> uncommon for people to have unhyphenated compound surnames, eg:
> 
>Bruce Smith Jones
> 
> To see the confusion this may cause:
> 
> https://en.wikipedia.org/wiki/Arthur_Conan_Doyle
> 
> It is better to ask for the forename input separately, or at least give the 
> user the option to override your decision.
> 
> 
> -- Clive
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/E644135A-7C74-4689-B3CB-6AA03224AC84%40indx.co.uk.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2B6C4AC8-1AE2-459D-9ED1-B5F954E9BD60%40schollnick.net.


Apple M1 Silicon + Django = weird results

2020-12-21 Thread Benjamin Schollnick
Folks,

I’m using django for an online gallery application, and I’ve seen some weird 
results since switching over to the M1 Mac Mini.
(Please note, I am running it under Rosetta / Intel Translation, since pillow 
doesn’t seem to build under M1 native).

So this could be a quirk of Rosetta, Django, or some combination of these.

I don’t think so, but it could be.

So What is happening?  

I never saw this under my 2013 intel iMac, but now under M1 (even under Rosetta 
2 / Intel translation) I am receiving a damaged / altered download file roughly 
6 out of 8 or 9 times (~25-33% successful).  

Just retrying the download will eventually be successful.  

This isn’t Pillow related, since the file is just being downloaded directly (no 
thumbnails or alterations to the file is occurring).

Does anyone have a suggestion on what to do at this time?  I’m uncertain on 
where to start to dig.  Although removing ranged_response, might be a starting 
point…

URLs:
path("download/", frontend.views.new_download, 
name="downloads"),
path('thumbnails/', frontend.views.thumbnails, name="raw 
thumbnails"),


First, I am using these function for all graphics and/or file(s) being sent:

def new_download(request, d_uuid=None):
page = request.GET.get('page', None)
if page is None:
download = index_data.objects.filter(uuid=d_uuid,
 ignore=False,
 delete_pending=False)[0]
else:
print ("Attempting to find page %s in archive" % page)
print("\tDownloading - %s, %s" % (download.fqpndirectory.lower(),
  download.name))
return respond_as_inline(request,
 "%s%s%s" % (
 configdata["locations"]["albums_path"],
 os.sep,
 download.fqpndirectory),
 download.name)


def respond_as_inline(request, file_path, original_filename, ranged=False):
# https://stackoverflow.com/questions/36392510/django-download-a-file
# 
https://stackoverflow.com/questions/27712778/video-plays-in-other-browsers-but-not-safari
# 
https://stackoverflow.com/questions/720419/how-can-i-find-out-whether-a-server-supports-the-range-header
filename = os.path.join(file_path, original_filename)
if os.path.exists(filename):
mtype, encoding = mimetypes.guess_type(original_filename)
if mtype is None:
mtype = 'application/octet-stream'
response = RangedFileResponse(request, file=open(filename, 'rb'), 
as_attachment=False, filename=os.path.basename(filename))
response["Content-Type"] = mtype
return response
raise Http404


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/75E15498-69D8-47B5-94D2-821C6B35CA92%40schollnick.net.


Re: Apple M1 Silicon + Django = weird results

2020-12-21 Thread Benjamin Schollnick

> Have you tried the download with various browsers? I wonder if Safari or 
> Chrome released at the same time as the M1 chips is causing different Range 
> header behavior than that code is designed to handle. So it might not be the 
> M1 chip, but just an unrelated change in browser software that got pushed out 
> at the same time. Speculating here.

The only issue that I see, is that I started to use RangedFileResponse to allow 
the viewing of MP4, and other media files in the browser…  (

So I know it works at least in that regard.  

But for debugging purposes, I’ll switch it around…

- Benjamin


> 
> On Mon, Dec 21, 2020 at 3:19 PM Benjamin Schollnick 
> mailto:bscholln...@schollnick.net>> wrote:
> Folks,
> 
> I’m using django for an online gallery application, and I’ve seen some weird 
> results since switching over to the M1 Mac Mini.
> (Please note, I am running it under Rosetta / Intel Translation, since pillow 
> doesn’t seem to build under M1 native).
> 
> So this could be a quirk of Rosetta, Django, or some combination of these.
> 
> I don’t think so, but it could be.
> 
> So What is happening?  
> 
> I never saw this under my 2013 intel iMac, but now under M1 (even under 
> Rosetta 2 / Intel translation) I am receiving a damaged / altered download 
> file roughly 6 out of 8 or 9 times (~25-33% successful).  
> 
> Just retrying the download will eventually be successful.  
> 
> This isn’t Pillow related, since the file is just being downloaded directly 
> (no thumbnails or alterations to the file is occurring).
> 
> Does anyone have a suggestion on what to do at this time?  I’m uncertain on 
> where to start to dig.  Although removing ranged_response, might be a 
> starting point…
> 
> URLs:
> path("download/", frontend.views.new_download, 
> name="downloads"),
> path('thumbnails/', frontend.views.thumbnails, name="raw 
> thumbnails"),
> 
> 
> First, I am using these function for all graphics and/or file(s) being sent:
> 
> def new_download(request, d_uuid=None):
> page = request.GET.get('page', None)
> if page is None:
> download = index_data.objects.filter(uuid=d_uuid,
>  ignore=False,
>  delete_pending=False)[0]
> else:
> print ("Attempting to find page %s in archive" % page)
> print("\tDownloading - %s, %s" % (download.fqpndirectory.lower(),
>   download.name <http://download.name/>))
> return respond_as_inline(request,
>  "%s%s%s" % (
>  configdata["locations"]["albums_path"],
>  os.sep,
>  download.fqpndirectory),
>  download.name <http://download.name/>)
> 
> 
> def respond_as_inline(request, file_path, original_filename, ranged=False):
> # https://stackoverflow.com/questions/36392510/django-download-a-file 
> <https://stackoverflow.com/questions/36392510/django-download-a-file>
> # 
> https://stackoverflow.com/questions/27712778/video-plays-in-other-browsers-but-not-safari
>  
> <https://stackoverflow.com/questions/27712778/video-plays-in-other-browsers-but-not-safari>
> # 
> https://stackoverflow.com/questions/720419/how-can-i-find-out-whether-a-server-supports-the-range-header
>  
> <https://stackoverflow.com/questions/720419/how-can-i-find-out-whether-a-server-supports-the-range-header>
> filename = os.path.join(file_path, original_filename)
> if os.path.exists(filename):
> mtype, encoding = mimetypes.guess_type(original_filename)
> if mtype is None:
> mtype = 'application/octet-stream'
> response = RangedFileResponse(request, file=open(filename, 'rb'), 
> as_attachment=False, filename=os.path.basename(filename))
> response["Content-Type"] = mtype
> return response
> raise Http404
> 
> 
> 
> -- 
> You received this message because you are subscribed 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 
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/75E15498-69D8-47B5-94D2-821C6B35CA92%40schollnick.net
>  
> <https://groups.google.com/d/msgid/django-users/75E15498-69D8-47B5-94D2-821

Re: Apple M1 Silicon + Django = weird results

2020-12-22 Thread Benjamin Schollnick
Just an update.

Working my way through the problem, it appears that either the data is being 
written truncated to the database, or Pillow is generating a truncated image 
preview (which is being stored to the database).

The later is more likely, since I am seeing no other data corruption errors.

Rewriting the thumbnail delivery code, seemed to reduce the amount of 
downloading issues, but they are still not Non-Zero…  

But I may just have to live with this, since there are too many moving parts to 
be able to point a finger at any one bit of code.  (It could be rosetta 2 
overly optimizing the code in some way…  etc.)

Plus, It might be time for me to just simply start rewriting the code from the 
ground up again, to better optimize and clean it up.  

- Benjamin



> On Dec 21, 2020, at 10:52 PM, Benjamin Schollnick 
>  wrote:
> 
> 
>> Have you tried the download with various browsers? I wonder if Safari or 
>> Chrome released at the same time as the M1 chips is causing different Range 
>> header behavior than that code is designed to handle. So it might not be the 
>> M1 chip, but just an unrelated change in browser software that got pushed 
>> out at the same time. Speculating here.
> 
> The only issue that I see, is that I started to use RangedFileResponse to 
> allow the viewing of MP4, and other media files in the browser…  (
> 
> So I know it works at least in that regard.  
> 
> But for debugging purposes, I’ll switch it around…
> 
>   - Benjamin
> 
> 
>> 
>> On Mon, Dec 21, 2020 at 3:19 PM Benjamin Schollnick 
>> mailto:bscholln...@schollnick.net>> wrote:
>> Folks,
>> 
>> I’m using django for an online gallery application, and I’ve seen some weird 
>> results since switching over to the M1 Mac Mini.
>> (Please note, I am running it under Rosetta / Intel Translation, since 
>> pillow doesn’t seem to build under M1 native).
>> 
>> So this could be a quirk of Rosetta, Django, or some combination of these.
>> 
>> I don’t think so, but it could be.
>> 
>> So What is happening?  
>> 
>> I never saw this under my 2013 intel iMac, but now under M1 (even under 
>> Rosetta 2 / Intel translation) I am receiving a damaged / altered download 
>> file roughly 6 out of 8 or 9 times (~25-33% successful).  
>> 
>> Just retrying the download will eventually be successful.  
>> 
>> This isn’t Pillow related, since the file is just being downloaded directly 
>> (no thumbnails or alterations to the file is occurring).
>> 
>> Does anyone have a suggestion on what to do at this time?  I’m uncertain on 
>> where to start to dig.  Although removing ranged_response, might be a 
>> starting point…
>> 
>> URLs:
>> path("download/", frontend.views.new_download, 
>> name="downloads"),
>> path('thumbnails/', frontend.views.thumbnails, 
>> name="raw thumbnails"),
>> 
>> 
>> First, I am using these function for all graphics and/or file(s) being sent:
>> 
>> def new_download(request, d_uuid=None):
>> page = request.GET.get('page', None)
>> if page is None:
>> download = index_data.objects.filter(uuid=d_uuid,
>>  ignore=False,
>>  delete_pending=False)[0]
>> else:
>> print ("Attempting to find page %s in archive" % page)
>> print("\tDownloading - %s, %s" % (download.fqpndirectory.lower(),
>>   download.name <http://download.name/>))
>> return respond_as_inline(request,
>>  "%s%s%s" % (
>>  configdata["locations"]["albums_path"],
>>  os.sep,
>>  download.fqpndirectory),
>>  download.name <http://download.name/>)
>> 
>> 
>> def respond_as_inline(request, file_path, original_filename, ranged=False):
>> # https://stackoverflow.com/questions/36392510/django-download-a-file 
>> <https://stackoverflow.com/questions/36392510/django-download-a-file>
>> # 
>> https://stackoverflow.com/questions/27712778/video-plays-in-other-browsers-but-not-safari
>>  
>> <https://stackoverflow.com/questions/27712778/video-plays-in-other-browsers-but-not-safari>
>> # 
>> https://stackoverflow.com/questions/720419/how-can-i-find-out-whether-a-server-supports-the-range-header
>>  
>> <https://sta

Re: Apple M1 Silicon + Django = weird results

2021-01-09 Thread Benjamin Schollnick
Okay, a further update.

While rewrite the code, did seem to make a marginal difference, the corruption 
issue persisted intermittently.

Just today, I did some more digging, and I remembered that I turned on Jumbo 
Frames for my ethernet port on the M1 Mac Mini.  

Turning that off, at first glance, seems to have resolved the corruption issue… 
 

I’m unclear if this is an Django, Rosetta 2, Big Sur, or M1 Mac mini hardware 
issue (or a combination of factors).  

I can’t check, but I’d swear that I had Jumbo frames turned on with My Catalina 
2013 iMac.  

Any ideas or suggestions?

- Benjamin



> On Dec 22, 2020, at 6:46 AM, Benjamin Schollnick  
> wrote:
> 
> Just an update.
> 
> Working my way through the problem, it appears that either the data is being 
> written truncated to the database, or Pillow is generating a truncated image 
> preview (which is being stored to the database).
> 
> The later is more likely, since I am seeing no other data corruption errors.
> 
> Rewriting the thumbnail delivery code, seemed to reduce the amount of 
> downloading issues, but they are still not Non-Zero…  
> 
> But I may just have to live with this, since there are too many moving parts 
> to be able to point a finger at any one bit of code.  (It could be rosetta 2 
> overly optimizing the code in some way…  etc.)
> 
> Plus, It might be time for me to just simply start rewriting the code from 
> the ground up again, to better optimize and clean it up.  
> 
>   - Benjamin
> 
> 
> 
>> On Dec 21, 2020, at 10:52 PM, Benjamin Schollnick 
>> mailto:bscholln...@schollnick.net>> wrote:
>> 
>> 
>>> Have you tried the download with various browsers? I wonder if Safari or 
>>> Chrome released at the same time as the M1 chips is causing different Range 
>>> header behavior than that code is designed to handle. So it might not be 
>>> the M1 chip, but just an unrelated change in browser software that got 
>>> pushed out at the same time. Speculating here.
>> 
>> The only issue that I see, is that I started to use RangedFileResponse to 
>> allow the viewing of MP4, and other media files in the browser…  (
>> 
>> So I know it works at least in that regard.  
>> 
>> But for debugging purposes, I’ll switch it around…
>> 
>>  - Benjamin
>> 
>> 
>>> 
>>> On Mon, Dec 21, 2020 at 3:19 PM Benjamin Schollnick 
>>> mailto:bscholln...@schollnick.net>> wrote:
>>> Folks,
>>> 
>>> I’m using django for an online gallery application, and I’ve seen some 
>>> weird results since switching over to the M1 Mac Mini.
>>> (Please note, I am running it under Rosetta / Intel Translation, since 
>>> pillow doesn’t seem to build under M1 native).
>>> 
>>> So this could be a quirk of Rosetta, Django, or some combination of these.
>>> 
>>> I don’t think so, but it could be.
>>> 
>>> So What is happening?  
>>> 
>>> I never saw this under my 2013 intel iMac, but now under M1 (even under 
>>> Rosetta 2 / Intel translation) I am receiving a damaged / altered download 
>>> file roughly 6 out of 8 or 9 times (~25-33% successful).  
>>> 
>>> Just retrying the download will eventually be successful.  
>>> 
>>> This isn’t Pillow related, since the file is just being downloaded directly 
>>> (no thumbnails or alterations to the file is occurring).
>>> 
>>> Does anyone have a suggestion on what to do at this time?  I’m uncertain on 
>>> where to start to dig.  Although removing ranged_response, might be a 
>>> starting point…
>>> 
>>> URLs:
>>> path("download/", frontend.views.new_download, 
>>> name="downloads"),
>>> path('thumbnails/', frontend.views.thumbnails, 
>>> name="raw thumbnails"),
>>> 
>>> 
>>> First, I am using these function for all graphics and/or file(s) being sent:
>>> 
>>> def new_download(request, d_uuid=None):
>>> page = request.GET.get('page', None)
>>> if page is None:
>>> download = index_data.objects.filter(uuid=d_uuid,
>>>  ignore=False,
>>>  delete_pending=False)[0]
>>> else:
>>> print ("Attempting to find page %s in archive" % page)
>>> print("\tDownloading - %s, %s" % (download.fqpndirectory.lower(),
>>>   download.name 
>>> <

Re: Good Django libraries to read to really understand class-based views?

2021-01-12 Thread Benjamin Schollnick
> I recommend you consider 
> https://spookylukey.github.io/django-views-the-right-way/

I second this, I’m going through this right now, and it’s very useful 
information regarding Class Based views vs Function Based views…

It’s making me consider rewriting Quickbbs/Gallery again, with a less kludgy 
approach.

- Benjamin



> On Jan 12, 2021, at 3:48 AM, Carsten Fuchs  wrote:
> 
> Dear Robert,
> 
> I recommend you consider 
> https://spookylukey.github.io/django-views-the-right-way/
> 
> Best regards,
> Carsten
> 
> 
> Am 11.01.21 um 16:14 schrieb Robert F.:
>> Are there any Django libraries that make extensive use of class-based views 
>> that I might study if I want to gain an in-depth understanding of how to use 
>> them? The Django documentation is OK at explaining what they are and how 
>> they work but most of the examples are very trivial in nature. I'd like to 
>> become a "power user" and for that I need lots of code to study. I've looked 
>> at the Classy Class-Based Views  examples but they seem 
>> too "meta" to me to shed any real light on how to use them in practice. 
>> Thanks.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/c3105eb8-7adf-8e95-e3d6-8908525eb3cb%40cafu.de.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1FDD7267-EEB3-4780-A06F-22673860709B%40schollnick.net.


Re: Classifieds page loading is to slow

2021-01-14 Thread Benjamin Schollnick
Also don’t forget to include Indexing.  

As a general rule, any field that you perform any query against, should be 
indexed.  
Yes, it costs a “bit” for disk space, but indexing can dramatically increase 
your query speed.

- Benjamin



> On Jan 14, 2021, at 10:44 PM, Benny M  wrote:
> 
> Slow loading can be sometimes be caused by non-optimized or overly complex 
> queries. Look into prefetch_related and select_related for starters. 
> https://docs.djangoproject.com/en/3.1/ref/models/querysets/ 
> 
> 
> Django Debug Toolbar is also a great packages for examining the interaction 
> between Django’s ORM and your database. 
> 
> Best,
> Benny
> 
>> On Jan 14, 2021, at 9:18 PM, Salima Begum  
>> wrote:
>> 
>> 
>> Hi all,
>> 
>> We are building a Web application, We have a classifieds page that is 
>> loading too slow. How to fix this issue. how to reduce loading time of 
>> classifieds page.
>> 
>> Thanks
>> ~Salima
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users+unsubscr...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAMSz6bnvP51oD_dfhY0YEWiGHGq3DbZ04u%2Bz6Vg_9sBPGvjgOw%40mail.gmail.com
>>  
>> .
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CH2PR14MB391358D987FFC8303F087CD5C0A70%40CH2PR14MB3913.namprd14.prod.outlook.com
>  
> .

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0B38486A-1A58-4FFF-A7FE-52FAB24099B6%40schollnick.net.


Re: Bind device with login id and password

2021-03-05 Thread Benjamin Schollnick


> On Mar 5, 2021, at 12:52 AM, Sachin Kumar  wrote:
> 
> Hi Experts,
> 
> Is there any way or logic in Django where we can bind user login id and 
> password with first device login id.
> for example:- 
> If a user first time login into a PC A, he can't login into PC B using same 
> login id. He can only login into PC A with his login id. if he changes the PC 
> then from backend we can remove his old registration and he can login into 
> New PC.
> 
> Please help me with the logic or any tutorial on this.

Built-in?  I doubt it.

But create a database field in the user record that you’ll use to store the IP 
in.  If the field is None, then accept any and all logins.  On a successful 
login, if the field is not None, then only allow a login if it’s from the IP 
address in that field.

Now,  ask yourself, why this isn’t normal procedure?

Simply because IP Addresses change, and people need to login from multiple 
devices (eg. Facebook on Desktop computer, Facebook on mobile device, etc).

Instead if you are looking for a more secure method of logging in, look at SQRL 
- https://github.com/miki725/django-sqrl 


And that’s “Squirrel” SQRL, designed by Steve gibson of GRC 
https://www.grc.com/sqrl/sqrl.htm 

But I have to Thank you, since I didn’t realize that there was a Django SQRL 
implementation until I just looked.  I’m going to look at adding this into my 
app.

- Benjamin

 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/043E5C63-5725-4E45-BF5E-2D7B8337B23D%40schollnick.net.


Re: Django application is slow

2021-03-24 Thread Benjamin Schollnick
> Dear Programmers, 
> my Django application is big and slow any leads on how to make it fast 
> responsive. 

In my experience, if the Django application is slow, it’s often related to the 
database either queries, or the database engine is scaled correctly.
(Of course, that’s assuming the computer Django is running on is scaled 
correctly)

To my knowledge Django Debug Toolbar has *NOT* been updated, and I started to 
run into compatibility issues with it.  I have had very limited success with 
SILK, but I don’t think I would recommend it….

What are your queries….?

Wait a sec.  DDT HAS been updated?  It claims to support 3.1.1 now?

Install DDT, and take a look at the Time specifically.  See what queries are 
taking the longest, and try to optimize those specifically.

Also, you do have Indexes on every field that you filter by, right?

- Benjamin



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/EA8CE296-A85D-4CD0-A86F-199AED72223C%40schollnick.net.


Re: Django application is slow

2021-03-24 Thread Benjamin Schollnick

> I have checked on the developer tool Waiting (TTFB) is taking 6 seconds. no 
> query is taking long i am sharing a picture of the developer tool response 
> you can have a look.
> 

That’s the devtools from the browser?

That has no visibility to your django queries, etc.  Install Django Debug 
Toolbar, which can monitor how long each section of the django process is 
taking so you can identify what is the real bottleneck.

The Web Browser Devtools can’t tell a dingo’s kidney about how long your 
queries are taking…

What the Web browser devtool is telling you is that the entire process of 
getting the web page is taking 6.01 seconds.

So it could be:

Header is sent from Django
Your Django page has queries embedded, or some other code that starts to run
Slowly each element is streamed to the web browser due to the Query processing 
time
The footer of the web page is sent

That entire process can easily explain the slow processing you are seeing, and 
would match what you are seeing in the WebBrowser Devtool.

Without additional information about your Django setup, we are only guessing.  
DDT can give us some additional insight.

- Benjamin

> 
> 
> 
> 
> On Wed, Mar 24, 2021 at 11:52 AM Benjamin Schollnick 
> mailto:bscholln...@schollnick.net>> wrote:
>> Dear Programmers, 
>> my Django application is big and slow any leads on how to make it fast 
>> responsive. 
> 
> In my experience, if the Django application is slow, it’s often related to 
> the database either queries, or the database engine is scaled correctly.
> (Of course, that’s assuming the computer Django is running on is scaled 
> correctly)
> 
> To my knowledge Django Debug Toolbar has *NOT* been updated, and I started to 
> run into compatibility issues with it.  I have had very limited success with 
> SILK, but I don’t think I would recommend it….
> 
> What are your queries….?
> 
> Wait a sec.  DDT HAS been updated?  It claims to support 3.1.1 now?
> 
> Install DDT, and take a look at the Time specifically.  See what queries are 
> taking the longest, and try to optimize those specifically.
> 
> Also, you do have Indexes on every field that you filter by, right?
> 
>   - Benjamin
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed 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 
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/EA8CE296-A85D-4CD0-A86F-199AED72223C%40schollnick.net
>  
> <https://groups.google.com/d/msgid/django-users/EA8CE296-A85D-4CD0-A86F-199AED72223C%40schollnick.net?utm_medium=email&utm_source=footer>.
> 
> -- 
> You received this message because you are subscribed 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 
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAP%2B6t01Wi7shjrqg_jM%3DEJzNmcLxYL0tTNGXmLYhv4bg9LEqbw%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/django-users/CAP%2B6t01Wi7shjrqg_jM%3DEJzNmcLxYL0tTNGXmLYhv4bg9LEqbw%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/154D5BAE-CCB4-4DBE-BD21-F25151805A85%40schollnick.net.


Re: Playing Video with Django and html tag

2021-04-21 Thread Benjamin Schollnick
What web browser are you using?

I had to work my way around this as well, and it ended up being that I had to 
use:

RangedFileResponse module.
Name: django-ranged-response
Version: 0.2.0
Summary: Modified Django FileResponse that adds Content-Range headers.
Home-page: https://github.com/wearespindle/django-ranged-fileresponse
Author: Spindle
Author-email: jer...@wearespindle.com
License: MIT
Location: /Users/benjamin/venvs/quickbbs/lib/python3.9/site-packages
Requires: django
Required-by: 

And I am using this wrapper, for the download:

def download(request, filename=None):
"""
Replaces new_download.  

This now takes http:///downloads/?UUID=

This fakes the browser into displaying the filename as the title of the
download.  

"""
# Is this from an archive?  If so, get the Page ID.
d_uuid=request.GET.get("UUID", None)
if d_uuid == None:
d_uuid=request.GET.get("uuid", None)

if d_uuid in ["", None]:
raise Http404

page = request.GET.get('page', None)
if page is None:
download = index_data.objects.filter(uuid=d_uuid,
 ignore=False,
 delete_pending=False)[0]
else:
print ("Attempting to find page %s in archive" % page)

print("\tDownloading - %s, %s" % (download.fqpndirectory.lower(),
  download.name))
  
movie = download.filetype.is_movie
return respond_as_inline(request,
 "%s%s%s" % (
 configdata["locations"]["albums_path"],
 os.sep,
 download.fqpndirectory),
 download.name,
 ranged=movie)


def respond_as_inline(request, file_path, original_filename, ranged=False):
# https://stackoverflow.com/questions/36392510/django-download-a-file
# 
https://stackoverflow.com/questions/27712778/video-plays-in-other-browsers-but-not-safari
# 
https://stackoverflow.com/questions/720419/how-can-i-find-out-whether-a-server-supports-the-range-header
filename = os.path.join(file_path, original_filename)
if os.path.exists(filename):
mtype, encoding = mimetypes.guess_type(original_filename)
if mtype is None:
mtype = 'application/octet-stream'

with open(filename, 'rb') as fh:
if ranged:
response = RangedFileResponse(request, file=open(filename, 
'rb'), as_attachment=False, filename=original_filename)
response["Content-Type"] = mtype
else:
response = HttpResponse(fh.read(), content_type=mtype)
response['Content-Disposition'] = 'inline; filename=%s'% 
original_filename
return response
else:
print("File not found")
raise Http404

For the web side..

{% if item.filetype.is_movie %}
 
  

{% endif %}

Hope that helps.  And yes, the python code is intended as a starting place, as 
it’s very specific to my implementation of a web gallery..
But I’m more than happy to try to help…

- Benjamin


> On Apr 21, 2021, at 8:10 PM, Thiago Luiz Parolin  
> wrote:
> 
> try using {% static.. to server your file.
> 
> ‪Em qua., 21 de abr. de 2021 às 19:44, ‫תמר בביוף‬‎  > escreveu:‬
> Hello everyone
>  :I try to enable a video tag in HTML like this 
> 
> 
> 
> :My problem is that the video does not run on Django, and looks like a black 
>  Running on html alone it works,  
> Does anyone know what the problem is? Is not a video tag enough when using 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/db9c1818-3312-45b4-a652-6a2dbc5bb688n%40googlegroups.com
>  
> .
> 
> 
> -- 
> Thiago Luiz Parolin
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CANbmKysnyHnW7yz6jL_rBS5xBrdroHmZNKTzn%2Bx2D2Vj0dy8aA%40mail.gmail.com
>  
> 

Re: module not found

2021-04-26 Thread Benjamin Schollnick
Okay, it appears you are on a Macintosh….

Which is not the problem, but I ran into the same issue, and it’s most likely 
that you installed a different version of Python than what came with the OS?

try:

python3 -m pip  list | grep -i django
python2 -m pip  list | grep -i django

I would bet even money, that the python2 command comes back with django being 
installed there…

That’s because the python2 install is earlier in the path than python3

How did I work around it, well.  That’s going to be a bit different for you 
since your using a different terminal package.
(In Apple’s Terminal -> Preferences -> Profiles -> Shell -> Startup,   check 
“Run Command”, and type “source ~/” assuming it’s in the user 
home directory.  
That will run the profile file on every opening of a terminal window, and thus 
load your presets.  I suspect that Parrot Terminal will have something similar)

(Yes, I know, why not use .profile or .bash_rc, etc, etc.  Because I don’t want 
the file to be hidden.  It can be updated by any text editor, even dropbox’s 
editor in the cloud, and it’s synced without having to worry about it.)

export PATH="/opt/homebrew/opt/python@3.9/libexec/bin:$PATH"
export PATH="/opt/homebrew/lib/python3.9/site-packages:$PATH"

Which points to the python 3.9.2 install that I have from homebrew.  

I previously used aliases with mixed luck at times.. 
(eg 
alias pip='python3.9 -m pip $*'
alias pip='python3.9 -m pip $*’
)
But that broke when I went to an M1 Mac, because it wasn’t possible to reliably 
get it to distinguish between an Rosetta2 session and an M1 session.  So
I stopped using the aliases.  I did eventually resolve the M1 / Rosetta2 
session smartly, but that’s a chunk of the profile file, and probably better 
left for another time.

Hope that helps…  

> On Apr 26, 2021, at 4:35 AM, Théodore KOSSI  wrote:
> 
> can you help me for this problem?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAKiMjQG3F-qktrhRd3mF-ucK2fn8ph55r_sKD8ue5HakuWc%3DRQ%40mail.gmail.com
>  
> .
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20E47B5D-99D9-41A6-95BF-91B606C08B07%40schollnick.net.


Better way to bring in tags automatically for Jinja2 templating?

2021-05-04 Thread Benjamin Schollnick
I'm not sure there is a better way to do this?

But I am using the Jinja2 templating engine with Django, and I originally set 
this up in Django2-ish?
So maybe I missed a better way to do this...

So I have a  jinjaenv.py file that simply setups up the environment for the 
Jinja2 template engine.

jinjaenv.py
```
#from __future__ import absolute_import  # Python 2 only
from jinja2 import Environment
from django.contrib.staticfiles.storage import staticfiles_storage
from django.urls import reverse
from django_icons.templatetags.icons import icon

def environment(**options):
env = Environment(**options)
env.globals.update({
   'static': staticfiles_storage.url,
   'url': reverse,
   'icon':icon,
})
return env
```
And have that in my settings:

# 
https://docs.djangoproject.com/en/2.1/ref/templates/api/#django.template.loaders.cached.Loader

{   'NAME': "Jinja2",
"BACKEND": "django_jinja.backend.Jinja2",
"APP_DIRS": True,
'DIRS': [TEMPLATE_PATH,],
"OPTIONS": {'environment': "quickbbs.jinjaenv.environment",
# Match the template names ending in .html but not the ones in the 
admin folder.
"match_extension": ".jinja",
"extensions": [
"jinja2.ext.do",
"jinja2.ext.loopcontrols",
"jinja2.ext.with_",
"jinja2.ext.i18n",
"jinja2.ext.autoescape",
"django_jinja.builtins.extensions.CsrfExtension",
"django_jinja.builtins.extensions.CacheExtension",
"django_jinja.builtins.extensions.TimezoneExtension",
"django_jinja.builtins.extensions.UrlsExtension",
"django_jinja.builtins.extensions.StaticFilesExtension",
"django_jinja.builtins.extensions.DjangoFiltersExtension",
],
 "bytecode_cache": {
 "name": "default",
 "backend": "django_jinja.cache.BytecodeCache",
 "enabled": True,
 },
 "autoescape": True,
 "auto_reload": True,
 "translation_engine": "django.utils.translation",
 }
},

Is there a better way to do this?  It’s a pain to update the environment file…
And I can’t tell if the django-icon issue that I’m seeing is due to Jinja2 or 
not. 
(I’m 99% sure it isn’t… But)

- Benjamin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/11398EAF-052F-45CD-91BE-1B4E36C3C5B3%40schollnick.net.


Watchdog & Django

2021-05-20 Thread Benjamin Schollnick
Folks,

I’m working on revamping the Gallery/viewer application that I wrote in Django.

One issue I’ve had is that it’s a dynamic on the fly thumbnail creator, but 
I’ve used a homebrew (fairly successfully) cached system to keep track of the 
directories & file contents.  Unlike many of the other gallery style 
applications I don’t require deliberate pre-scanning, the files are detected, 
and thumbnailed in realtime.  

But I realized that I can use Watchdog to simplify that logic, and eliminate 
the need for any caching.

My idea is to have a table that is cleared at every startup, and it just 
contains the directories that have been scanned for that execution of the 
program.  If watchdog has detected a change in a directory, it’s just removed 
from that table, which makes it a candidate for rescanning the next time 
someone views that directory.

But the big kicker is that I can’t find any documentation that can help me add 
watchdog monitoring into Django.  

Now, I know that Django does something similar in the Dev server (which is what 
I primarily use right now)…  And I’ve found a stackoverflow, whichs that I can 
use Signal to capture the SIGINT on shutdown (allowing me to stop watchdog )…  
I should be able to start watchdog in the __init__  file in the APP directory 
as well…  

Now this is the sample app that I used:

import sys
import time
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler

def on_created(event):
print(f"hey, {event.src_path} has been created!")

def on_deleted(event):
print(f"what the f**k! Someone deleted {event.src_path}!")

def on_modified(event):
print(f"hey buddy, {event.src_path} has been modified")

def on_moved(event):
print(f"ok ok ok, someone moved {event.src_path} to {event.dest_path}")

if __name__ == "__main__”:

#   <— startup —> 
patterns = ["*"]
ignore_patterns = None
ignore_directories = False
case_sensitive = True
my_event_handler = PatternMatchingEventHandler(patterns, ignore_patterns, 
ignore_directories, case_sensitive)

my_event_handler.on_created = on_created
my_event_handler.on_deleted = on_deleted
my_event_handler.on_modified = on_modified
my_event_handler.on_moved = on_moved

path = sys.argv[1]#"."
go_recursively = True
my_observer = Observer()
my_observer.schedule(my_event_handler, path, recursive=go_recursively)

my_observer.start()

# stop startup

try:
while True:
time.sleep(1)
except KeyboardInterrupt:
# shutdown
my_observer.stop()
my_observer.join()


Nothing fancy, just a proof of concept based on code that I found online.

Anyone have any suggestions?

I’m thinking that  I could add the startup .. stop startup to an function in 
the __init__ and run that at startup.
And that capturing the SIGINT, and when SIGINT is tripped, I can do the 
observer.stop & join?

Would it be that simple?  Am I missing something?  Is there a better way to do 
this in Django?  
I don’t want to have to stand up a celery server, if I can run this, or 
something equivalent inside of Django…

I haven’t been able to (yet) trackdown STATRELOADER, which appears to be the 
Django built-in equivalent, so I can’t tell if I can repurpose that to do this 
instead?

I’m open to suggestions…

- Benjamin

 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/D8BB20B3-0063-4D93-BB39-A39FD66CD860%40schollnick.net.


Re: Watchdog & Django

2021-05-23 Thread Benjamin Schollnick
Okay, this was a bit more complex, and a bit simpler than I thought.

1)  The Django app __init__ is the only place you can place the signal to stop 
the watchdog function.  
2) You can’t perform any app model specific work in the __init__ because the 
app’s model frame work wasn’t yet finished initializing.  So I ended up with a 
chicken & egg situation.

Now, this does *exactly*  what I needed to do, so this might not be needed for 
anyone else, but it without a doubt simplifies any sort of file caching issue, 
since you can invalidate the cache with whatever granularity you wanted (eg 
File Level, or in my case, Directory level).  

I created a class to contain the watchdog specific code, and a table that 
stored the list of cached directories (to invalidate, I just remove the 
directory name from that table).  

The existing scanning code is just bypassed if it’s already been scanned, if 
it’s invalidated, it’ll just refresh the listing(s) in the database.

eg. 

in watchdogmon.py:
class watchdog_monitor():
def __init__(self):
self.my_observer = Observer()
self.my_event_handler = None

def on_event(self, event):
pass

def startup(self, monitor_path, created=None,
deleted=None, modified=None,
moved=None):
print("Monitoring :", monitor_path)
patterns = ["*"]
ignore_patterns = None
ignore_directories = False
case_sensitive = False
self.my_event_handler = PatternMatchingEventHandler(patterns, 
ignore_patterns,
   ignore_directories,
   case_sensitive)

self.my_event_handler.on_created = created
self.my_event_handler.on_deleted = deleted
self.my_event_handler.on_modified = modified
self.my_event_handler.on_moved = moved

go_recursively = True
self.my_observer = Observer()
self.my_observer.schedule(self.my_event_handler,
  monitor_path,
  recursive=go_recursively)

self.my_observer.start()


def shutdown(self, *args):
if os.environ.get('RUN_MAIN') == 'true':
print("Shutting down")
self.my_observer.stop()
self.my_observer.join()
#signal.send('system')
sys.exit(0)   # So runserver does try to exit

watchdog = watchdog_monitor()

In __init__.py:
signal.signal(signal.SIGINT, watchdogmon.watchdog.shutdown)

In views.py:
print("Clearing all entries from Cache Tracking")
Cache_Tracking.objects.all().delete()

print("Starting Watchdog")
from frontend.utilities import delete_from_cache_tracking
watchdog.startup(monitor_path=os.path.join(configdata["locations"]["albums_path"],
   "albums"), 
created=delete_from_cache_tracking,
   deleted=delete_from_cache_tracking,
   modified=delete_from_cache_tracking,
   moved=delete_from_cache_tracking)

where delete_from_cache_tracking, just deletes the event.src_path from the 
cache_Tracking table.

Now, the drawback here is that watchdog utilizes the fsevents framework under 
Mac OS X, so there is no practical limit to what it can track, the OS is doing 
the work watchdog is wrapping around OS provided functionality.  (Or at least 
that is my understanding)

So under Mac OS X, it’s tracking probably millions or at least 10’s of 
thousands of files, and directories.

Under Windows, or Unix, my understanding is that watchdog requires a file 
handle per directory?  So some tweaking maybe required to prevent from running 
out of file handles under a large directory structure / number of files.  

Hope this helps someone else that is trying to integrate watchdog into Django.

- BEnjamin






> On May 20, 2021, at 10:14 PM, Benjamin Schollnick 
>  wrote:
> 
> Folks,
> 
> I’m working on revamping the Gallery/viewer application that I wrote in 
> Django.
> 
> One issue I’ve had is that it’s a dynamic on the fly thumbnail creator, but 
> I’ve used a homebrew (fairly successfully) cached system to keep track of the 
> directories & file contents.  Unlike many of the other gallery style 
> applications I don’t require deliberate pre-scanning, the files are detected, 
> and thumbnailed in realtime.  
> 
> But I realized that I can use Watchdog to simplify that logic, and eliminate 
> the need for any caching.
> 
> My idea is to have a table that is cleared at every startup, and it just 
> contains the directories that have been scanned for that execution of the 
> program.  If watchdog has detected a change in a directory, it’s just removed 
> from

Re:

2021-07-18 Thread Benjamin Schollnick
Good luck.

If the user can play the video, then they by definition have to be able to 
download the video.  Unless you want to create your own proprietary streaming 
mechanism, if the web browser can display the video, it has to be able to cache 
the video (eg download it locally).  

For example, you can easily download almost any video off of youtube, without 
issue.  See youtube-dl, as well as dozens of other applications that can do 
this. 

Yes, there are ways to make this harder, but to play the video the computer has 
to be able to use some mechanism to download the video.

- Benjamin



> On Jul 18, 2021, at 9:44 PM, pankaj palmate  
> wrote:
> 
> Hello please help me in this, I want to provide my video content to users  
> and my objects are stored in AWS s3 buckets.I want user to view video for 1 
> year of validity but restrict to download the video...also he will have acess 
> through my website only(i.e. he should not use s3 object url to access the 
> file and download using Chrome)
> Thanks in advance
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAPyMU1%2Bwwd6q%2B8m2LpJC6rUB1jxEzHQmh4800AzqBoZ8cW%2BAJw%40mail.gmail.com
>  
> .

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/C626942B-E102-476B-A136-733EC3B74712%40schollnick.net.


Re:

2021-07-19 Thread Benjamin Schollnick
They are presumably streaming the video, which means that they are using a 
proprietary video player, as well as requiring a registration/subscription.

So you can in theory, license a video player which supports some sort of 
encryption/login/subscription support, but if the video can be played, it can 
be downloaded. 
But that’s not a Django issue, that’s really more of a web server/web client 
issue.  

Take a look at JWPlayer, or some of the video players here - 
https://medium.com/@johnksmithme/top-10-best-html5-video-players-in-2019-4d5434de50a1
 
<https://medium.com/@johnksmithme/top-10-best-html5-video-players-in-2019-4d5434de50a1>

- Benjamin



> On Jul 19, 2021, at 1:12 AM, pankaj palmate  
> wrote:
> 
> Hii ,Thank you for your response...but what hotstar does because i think 
> their videos are not possible to download and if not how can we make it hard 
> to download ?any referell link?
> 
> On Mon, 19 Jul, 2021, 7:38 am Benjamin Schollnick, 
> mailto:bscholln...@schollnick.net>> wrote:
> Good luck.
> 
> If the user can play the video, then they by definition have to be able to 
> download the video.  Unless you want to create your own proprietary streaming 
> mechanism, if the web browser can display the video, it has to be able to 
> cache the video (eg download it locally).  
> 
> For example, you can easily download almost any video off of youtube, without 
> issue.  See youtube-dl, as well as dozens of other applications that can do 
> this. 
> 
> Yes, there are ways to make this harder, but to play the video the computer 
> has to be able to use some mechanism to download the video.
> 
>   - Benjamin
> 
> 
> 
>> On Jul 18, 2021, at 9:44 PM, pankaj palmate > <mailto:pankajpalmate61...@gmail.com>> wrote:
>> 
>> Hello please help me in this, I want to provide my video content to users  
>> and my objects are stored in AWS s3 buckets.I want user to view video for 1 
>> year of validity but restrict to download the video...also he will have 
>> acess through my website only(i.e. he should not use s3 object url to access 
>> the file and download using Chrome)
>> Thanks in advance
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users+unsubscr...@googlegroups.com 
>> <mailto:django-users+unsubscr...@googlegroups.com>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAPyMU1%2Bwwd6q%2B8m2LpJC6rUB1jxEzHQmh4800AzqBoZ8cW%2BAJw%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/django-users/CAPyMU1%2Bwwd6q%2B8m2LpJC6rUB1jxEzHQmh4800AzqBoZ8cW%2BAJw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> 
> 
> -- 
> You received this message because you are subscribed 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 
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/C626942B-E102-476B-A136-733EC3B74712%40schollnick.net
>  
> <https://groups.google.com/d/msgid/django-users/C626942B-E102-476B-A136-733EC3B74712%40schollnick.net?utm_medium=email&utm_source=footer>.
> 
> -- 
> You received this message because you are subscribed 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 
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAPyMU1%2Bycgp9oTTDNXGfRAe7mV6KqEAaZM6oHkwF18r%3D0FT97A%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/django-users/CAPyMU1%2Bycgp9oTTDNXGfRAe7mV6KqEAaZM6oHkwF18r%3D0FT97A%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/69E74D6F-9C7F-44C2-8CF2-4BC46A4FEFB7%40schollnick.net.


Re:

2021-07-22 Thread Benjamin Schollnick
> Only for practice, I want to built a video downloader web app, from a 
> specific website.
> Problem
>first I have to download the video and then send to the user, it time 
> consuming I want to directly download at the user side, is it possible in 
> Django.

Is this possible, yes.  Take a look at youtube-dl, and other applications along 
that line.

Is it possible using Django,  Not as you describe. 

Django is a framework (tool set/tool chest) that simplifies and assists in the 
creation of web sites, and more so of database driven web sites.

Unless you are going to be having your users hosting web sites, Django isn’t 
going to be immediately helpful.

Now, you doing something Python driven, as I explained above, would be 
conceivable.

- Benjamin



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8A06F22E-7130-42A4-BACE-71C58BAE8A05%40schollnick.net.


Re: Git Hub Project

2021-08-10 Thread Benjamin Schollnick
> Thank you very much for your kind words. I am facing this errors :
> 
> > ',' or ')' expected
> > Unexpected indent
> > Statement expected, found Py:DEDENT
> 
> for the last 2,3 days. Kindly help me out.

You need to share your code.

Pycharm should be dropping you exactly on the line that is resulting in this 
error.

Without it, we are guessing.

- Benjamin

> On Aug 10, 2021, at 8:03 AM, Rana Zain  wrote:
> 
> 
> 
> On Monday, August 9, 2021 at 5:43:06 PM UTC+5 Kasper Laudrup wrote:
> On 09/08/2021 14.24, Rana Zain wrote: 
> > 
> > Thank you so much everyone. It's work. 
> > 
> > I have another problem. I am facing this issue in Pycharm .  I tried 
> > spaces & tabs. 
> > 
> > Error is :"Unindent does not match any outer indentation level"" 
> 
> Python uses indentation for scoping unlike most other programming 
> languages. That is very important and basic knowledge and doesn't have 
> anything to do with Pycharm. 
> 
> I would suggest you start by finding a tutorial, book or similar on 
> Python for absolute beginners and then take it slowly from there. 
> 
> A quick search showed this: 
> 
> https://python.land/python-tutorial  
> 
> But others might have some better suggestions. 
> 
> Good luck on learning Python. It's a nice and very forgiving language so 
> you'll make progress very quickly, but like with most other things, you 
> do need some amount of patience to get started. 
> 
> Kind regards, 
> 
> Kasper Laudrup 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/94bde1d2-ba4e-480e-8ef6-f71f1626a88en%40googlegroups.com
>  
> .

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/28357425-0375-41AC-96C4-B033508132DD%40schollnick.net.


Re: Git Hub Project

2021-08-10 Thread Benjamin Schollnick
What editor are you using?

And it’s not spaces & Tabs, it’s one or the other.  

It has to be uniform.  

And have you looked at all at the Python Tutorial? The Python Tutorial — Python 
3.9.6 documentationhttps://docs.python.org › tutorial 


That message means that your code blocks aren’t lined up.  Usually that’s 
because you have an unseen tab, or you are off with your spacing.  But if 
everything looks fine, then it probably means you have an embedded “invisible” 
tab.

Show the code, or at least the rest of the error block.  It should show the 
line number that you need to examine.

- Benjamin



> On Aug 10, 2021, at 10:10 AM, Rana Zain  wrote:
> 
> @Ryan i tired many times tabs and spaces. But not work.
> 
> On Tuesday, August 10, 2021 at 6:50:41 PM UTC+5 Ryan Nowakowski wrote:
> You might have mixed tabs and spaces. PEP8 standard is 4 spaces per level of 
> indentation, IIRC.
> 
> 
> On August 9, 2021 7:24:56 AM CDT, Rana Zain  > wrote:
> 
> Thank you so much everyone. It's work.
> 
> I have another problem. I am facing this issue in Pycharm .  I tried spaces & 
> tabs.
> 
> Error is :"Unindent does not match any outer indentation level""
> On Thursday, August 5, 2021 at 11:15:27 AM UTC+5 satyajit...@gmail.com 
>  wrote:
> what exactly you're trying to do?
> 
> On Wed, Aug 4, 2021 at 6:41 PM Rana Zain > wrote:
> Hi,
> Can anybody help me in running git clone django Project?
> 
> -- 
> You received this message because you are subscribed 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/425c8297-2097-4952-b2ac-3fa299ff6011n%40googlegroups.com
>  
> .
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/580eb0db-31b7-4fab-b887-db69ed47e0ban%40googlegroups.com
>  
> .

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9E59954B-FAC1-49DE-83F3-57250DBA010B%40schollnick.net.


Re: You're accessing the development server over HTTPS, but it only supports HTTP.

2021-09-30 Thread Benjamin Schollnick
FYI - Seems to have no effect on that error.  

>From what I see the development server just doesn’t support SSL.

But, here are instructions on setting it up.

https://timonweb.com/django/https-django-development-server-ssl-certificate/ 


I have not yet tested these instructions, and also, I might suggest instead 
taking a look to see if it’s possible to get Let’s Encrypt to work with Django 
dev server?

Actually going further, I see:

https://github.com/teddziuba/django-sslserver 


Which appears to have been updated for Django 3.7 or so, and claims to have no 
outside dependencies, and a bit clearer documentation?
And describes how it could use a Let’s Encrypt key.  

I’m not sure which one I’m going to try…  But it does seem possible that a dev 
server can be updated easily to use SSL.

- Benjamin



> On Sep 30, 2021, at 6:04 AM, Adeyemi Deji  wrote:
> 
> Make sure debug is set to True in settings.py file. allowed host should be an 
> empty list
> 
> On Thu, 30 Sep 2021, 10:43 emmanuel odor,  > wrote:
> Hi Everyone,
> 
> I tried to run Django micro crm locally on my windows host and  whenever i 
> run this on my browser i get these errors below.
> 
> Starting development server at http://127.0.0.1:8000/ 
> Quit the server with CTRL-BREAK.
> [30/Sep/2021 10:40:04] code 400, message Bad request version 
> ('**\x13\x01\x13\x02\x13\x03À+À/À,À0̨̩À\x13À\x14\x00\x9c\x00\x9d\x00/\x005\x01\x00\x01\x93úú\x00\x00\x00\x17\x00\x00ÿ\x01\x
> 00\x01\x00\x00')
> [30/Sep/2021 10:40:04] You're accessing the development server over HTTPS, 
> but it only supports HTTP.
> 
> [30/Sep/2021 10:40:04] code 400, message Bad request version 
> ('úú\x13\x01\x13\x02\x13\x03À+À/À,À0̨̩À\x13À\x14\x00\x9c\x00\x9d\x00/\x005\x01\x00\x01\x93ÚÚ\x00\x00\x00\x17\x00\x00ÿ\x01\x
> 00\x01\x00\x00')
> [30/Sep/2021 10:40:04] You're accessing the development server over HTTPS, 
> but it only supports HTTP.
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/35a1ec5c-3b6e-4a3b-9d10-b3e1f8b48c94n%40googlegroups.com
>  
> .
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAEO1Grojh1%3DVeCxTwFKaFiJrNSgHHJsG4%2BBRdvquw4PqgqSiKg%40mail.gmail.com
>  
> .

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0F83AD9B-52FA-4C7E-9E8E-1C2A29C6A3AE%40schollnick.net.


Re: Django 3.0 alpha 1 released

2019-09-10 Thread Benjamin Schollnick
We've made the first release on the way to Django's next major 

> release, Django 3.0! 
>
> With about two and a half months until the 
> final release (scheduled for December 2nd), we'll need timely testing 
> from the community to ensure an on-time, stable release. 
>
> Check out the blog post: 
>
>
> https://www.djangoproject.com/weblog/2019/sep/10/django-30-alpha-1-released/


The updates look nice...

1) Is there any plans to officially support MS SQL server directly?
   There are a few different ways to connect to an MSSQL server, but none
   of them are very well maintained (in a timely manner).   I am currently
   using https://github.com/michiya/django-pyodbc-azure
   , which is forcing me to
   stay at django v2.1.xx, and I've used django-mssql in the past
   (but that hasn't been updated to django v2.xx).   Having an
   officially supported, and updated ms sql bridge would be quite helpful.

2) Its still early, but how does the performance match up against v2.xx?

- Benjamin 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9f404ffe-b272-4944-8e98-80e8f9e5ad4a%40googlegroups.com.


Re: Django 3.0 alpha 1 released

2019-09-10 Thread Benjamin Schollnick
> On Sep 10, 2019, at 5:29 AM, Carlton Gibson  wrote:
> 
> We've made the first release on the way to Django's next major 
> release, Django 3.0! 
> 
> With about two and a half months until the 
> final release (scheduled for December 2nd), we'll need timely testing 
> from the community to ensure an on-time, stable release. 
> 
> Check out the blog post: 
> 
> https://www.djangoproject.com/weblog/2019/sep/10/django-30-alpha-1-released/ 
> 
Looks nice…

1) Is there any plans to officially support MS SQL server directly?  There are 
a few different ways to connect to an MSSQL server, but none of them are very 
well maintained (in a timely manner).   I am currently using 
https://github.com/michiya/django-pyodbc-azure 
, which is forcing me to stay 
at django v2.1.xx, and I’ve used django-mssql in the past (but that hasn’t been 
updated to django v2.xx).   Having an officially supported, and updated ms sql 
bridge would be quite helpful.

2) It’s still early, but how does the performance match up against v2.xx?

- Benjamin


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8B56E6CD-1EFD-457A-B602-7BDF0D0498BF%40schollnick.net.