Django compressor issue - media assets from the forms.py won't update in the frontend django template

2019-05-25 Thread Danny Blaker
We are currently experiencing an issue with the Django compressor: We have 
an app that has forms.py and its media assets from the forms.py won't 
update in the frontend django template (only stuff inside the django 
compress tag won't update). This problem came about when we initially 
included external files in the static files media asset in forms.py, but 
that lead to problems with django compressor not being able to compress and 
access via our Cloudfront CDN. We changed that and now, it's stuck there, 
meaning it won't refresh with our newer local static files (we changed 
external file links to local static in the Media class inside forms.py). We 
have flushed our Redis node, done cloudfront invalidations, compressed 
again, collectstatic, terminated and started new instance within 
elasticbeanstalk. Has anyone had experience a similar issue and / or has 
any solutions? Many Thanks!!

Our architecture:
Elasticbeanstalk. (amazon's linux ec2 instance, python)
RDS (postgres database)
Elasticache (Redis)

-- 
You received this message because you are subscribed to the Google Groups 
"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/e7c32975-a0d8-4254-bbaf-42d502b9a47b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to get object id from database?

2019-05-25 Thread Rob Gmail
Look at the new Boston.com he did a tutorial on exactly this issue

Rob 
203-671-6514
Sent from my mobile device, please excuse the typos. 

> On May 25, 2019, at 7:25 PM, Yoo  wrote:
> 
> Maybe try album__id (two underscores)? Or try album_title as defined in the 
> Album model. I also advise not to expose your primary key in the URL. If the 
> above did not work, check Django  documentation: 
> https://docs.djangoproject.com/en/2.2/topics/http/urls/
> 
>> On Saturday, May 25, 2019 at 2:46:58 PM UTC-4, Anchal Agarwal wrote:
>> I am currently working on a django project in which there is a music app. 
>> The models of this app contains Albums and Songs. I want to return the http 
>> response when the django receives a url as /music/712 , here 712 is the 
>> object id.
>> Please help me out in resolving the issue.Thanks in advance.
>> 
>> Here are my files. Here album_id will be the id of the object.
>> models.py
>> from django.db import models
>> 
>> class Album(models.Model):
>> artist = models.CharField(max_length=250)
>> album_title = models.CharField(max_length=500)
>> genre=models.CharField(max_length=100)
>> album_logo = models.CharField(max_length=1000)
>> 
>> def __str__(self):
>> return self.album_title 
>> 
>> class Song(models.Model):
>> album= models.ForeignKey(Album, on_delete=models.CASCADE)
>> file_type= models.CharField(max_length=10)
>> song_title = models.CharField(max_length=250)
>> 
>> views.py
>> from django.shortcuts import render
>> from django.http import HttpResponse
>> 
>> def homepage(request):
>> return HttpResponse("You are looking music!!")
>> 
>> def detail(request, album_id):
>> return HttpResponse("Details for Album id:"+ str(album_id)+ "")
>> 
>> 
>> urls.py
>>  
>> from django.urls import path
>> from . import views
>> 
>> app_name="music"
>> 
>> urlpatterns=[
>> #/music/
>> path('',views.homepage,name='homepage'),
>> 
>> # /music/712
>> path('[0-9]+/',views.detail,name='detail'),
>> ]
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "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/848dc27b-9d4c-42a1-a691-c74ac4112e41%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/01D40376-A294-48D1-AD09-47C6A3E25C6B%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to get object id from database?

2019-05-25 Thread Yoo
Maybe try album__id (two underscores)? Or try album_title as defined in the 
Album model. I also advise not to expose your primary key in the URL. If 
the above did not work, check Django  documentation: 
https://docs.djangoproject.com/en/2.2/topics/http/urls/

On Saturday, May 25, 2019 at 2:46:58 PM UTC-4, Anchal Agarwal wrote:
>
> I am currently working on a django project in which there is a music app. 
> The models of this app contains Albums and Songs. I want to return the http 
> response when the django receives a url as /music/712 , here 712 is the 
> object id.
> Please help me out in resolving the issue.Thanks in advance.
>
> Here are my files. Here album_id will be the id of the object.
> models.py
> from django.db import models
>
> class Album(models.Model):
> artist = models.CharField(max_length=250)
> album_title = models.CharField(max_length=500)
> genre=models.CharField(max_length=100)
> album_logo = models.CharField(max_length=1000)
>
> def __str__(self):
> return self.album_title 
>
> class Song(models.Model):
> album= models.ForeignKey(Album, on_delete=models.CASCADE)
> file_type= models.CharField(max_length=10)
> song_title = models.CharField(max_length=250)
>
> views.py
> from django.shortcuts import render
> from django.http import HttpResponse
>
> def homepage(request):
> return HttpResponse("You are looking music!!")
>
> def detail(request, album_id):
> return HttpResponse("Details for Album id:"+ str(album_id)+ "")
>
> urls.py
>  
> from django.urls import path
> from . import views 
>
> app_name="music"
>
> urlpatterns=[
> #/music/
> path('',views.homepage,name='homepage'),
>
> # /music/712
> path('[0-9]+/',views.detail,name='detail'),
> ]
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/848dc27b-9d4c-42a1-a691-c74ac4112e41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Right method for url mapping

2019-05-25 Thread Yoo
First one. Usually I'd have it be views.index. Otherwise, the first one is 
perfectly fine. Need explanation?

On Saturday, May 25, 2019 at 7:14:18 PM UTC-4, Saeed Pooladzadeh wrote:
>
> Hello
>
> Wich of them is the right method for url mapping:
>
>   path('', views.show, name='index'),
>
> or
>
> path('index', views.show),
>
> Regards,
>
> Saeed
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/2a7fc8e5-cd5a-42e4-bb38-9fb816e0463d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Too many tables with 10 columns each?

2019-05-25 Thread Yoo
There are 200 tables with 11 columns, including 4 foreign keys. Is 200 
tables too many tables? This is the error I'm getting:

Operations to perform:
  Apply all migrations: admin, auth, contenttypes, public, sessionsRunning 
migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying public.0001_initial... OK
  Applying public.0002_auto_20190525_1519... OK
  Applying public.0003_auto_20190525_1519... OKFatal Python error: Cannot 
recover from stack overflow.
Current thread 0x0f70 (most recent call first):
  File 
"c:\users\yoom\appdata\local\programs\python\python37-32\Lib\contextlib.py", 
line 130 in __exit__
  File 
"C:\Users\yoom\Code\test\testvenv\lib\site-packages\django\db\migrations\state.py",
 line 318 in render_multiple
  File 
"C:\Users\yoom\Code\test\testvenv\lib\site-packages\django\db\migrations\state.py",
 line 191 in _reload
  File 
"C:\Users\yoom\Code\test\testvenv\lib\site-packages\django\db\migrations\state.py",
 line 158 in reload_model
  File 
"C:\Users\yoom\Code\test\testvenv\lib\site-packages\django\db\migrations\operations\models.py",
 line 739 in state_forwards
  File 
"C:\Users\yoom\Code\test\testvenv\lib\site-packages\django\db\migrations\migration.py",
 line 114 in apply
  File 
"C:\Users\yoom\Code\test\testvenv\lib\site-packages\django\db\migrations\executor.py",
 line 245 in apply_migration
  File 
"C:\Users\yoom\Code\test\testvenv\lib\site-packages\django\db\migrations\executor.py",
 line 147 in _migrate_all_forwards
  File 
"C:\Users\yoom\Code\test\testvenv\lib\site-packages\django\db\migrations\executor.py",
 line 117 in migrate
  File 
"C:\Users\yoom\Code\test\testvenv\lib\site-packages\django\core\management\commands\migrate.py",
 line 234 in handle
  File 
"C:\Users\yoom\Code\test\testvenv\lib\site-packages\django\core\management\base.py",
 line 83 in wrapped
  File 
"C:\Users\yoom\Code\test\testvenv\lib\site-packages\django\core\management\base.py",
 line 364 in execute
  File 
"C:\Users\yoom\Code\test\testvenv\lib\site-packages\django\core\management\base.py",
 line 323 in run_from_argv
  File 
"C:\Users\yoom\Code\test\testvenv\lib\site-packages\django\core\management\__init__.py",
 line 375 in execute
  File 
"C:\Users\yoom\Code\test\testvenv\lib\site-packages\django\core\management\__init__.py",
 line 381 in execute_from_command_line
  File "manage.py", line 17 in main
  File "manage.py", line 21 in 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/564f9c83-2192-4864-8afd-980cd5c5f865%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Right method for url mapping

2019-05-25 Thread Saeed Pooladzadeh
Hello

Wich of them is the right method for url mapping:

  path('', views.show, name='index'),

or

path('index', views.show),

Regards,

Saeed

-- 
You received this message because you are subscribed to the Google Groups 
"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/ce8555d8-dd90-4895-ac15-8369bbc2d1d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to get object id from database?

2019-05-25 Thread anchal agarwal
I am currently working on a django project in which there is a music app.
The models of this app contains Albums and Songs. I want to return the http
response when the django receives a url as /music/712 , here 712 is the
object id.
Please help me out in resolving the issue.Thanks in advance.

Here are my files. Here album_id will be the id of the object.
models.py
from django.db import models

class Album(models.Model):
artist = models.CharField(max_length=250)
album_title = models.CharField(max_length=500)
genre=models.CharField(max_length=100)
album_logo = models.CharField(max_length=1000)

def __str__(self):
return self.album_title

class Song(models.Model):
album= models.ForeignKey(Album, on_delete=models.CASCADE)
file_type= models.CharField(max_length=10)
song_title = models.CharField(max_length=250)

views.py
from django.shortcuts import render
from django.http import HttpResponse

def homepage(request):
return HttpResponse("You are looking music!!")

def detail(request, album_id):
return HttpResponse("Details for Album id:"+ str(album_id)+ "")

urls.py

from django.urls import path
from . import views

app_name="music"

urlpatterns=[
#/music/
path('',views.homepage,name='homepage'),

# /music/712
path('[0-9]+/',views.detail,name='detail'),
]

-- 
You received this message because you are subscribed to the Google Groups 
"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/CAMT%3DisUwfvM8grFurgdK44uyHm2%3Djaw8pihEu1YMzrfQboCz1w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Hosting

2019-05-25 Thread Subramanian Sridharan
I prefer PythonAnywhere  for hosting. 

On Saturday, May 25, 2019 at 5:27:12 PM UTC+5:30, Prakash Borade wrote:
>
> Friends tell me is hostgator.in server support django or not.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3514eafe-e9bb-4d94-b99a-cfc9a698aa0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Hosting

2019-05-25 Thread Tim Chase
On 2019-05-24 23:19, Prakash Borade wrote:
> Friends tell me is hostgator.in server support django or not.

Hostgator used to be a decent company until they were bought out by
EIG, a parent company with a reputation of buying up good hosting
companies and turning them into a bucket of suck.  They over allocate
their shared hosts, customer/technical service is slow and
inconvenient (they tend to shut down email and web case submission in
favor of chat, but then are slow to answer chats if at all; nagging
on Twitter will get a "please give us the case# and we'll escalate
it" which largely means they'll actually look at it)

I had service with one that got bought out by EIG and turned
horrible (and AFAICT, ended up going under as a business), so I fled
to another (Site5) which also got bought out by EIG and also turned
horrible. So I'd avoid any EIG property unless you don't care about
the quality of your hosting:

https://www.linux-depot.com/non-endurance-international-group-eig-hosting/

I have good things to say (from either personal experience or the
experiences of those I trust) about Digital Ocean, Heroku, Linode,
OVH, and Vultr.

-tkc


-- 
You received this message because you are subscribed to the Google Groups 
"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/20190525074048.56e46d94%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.


Hosting

2019-05-25 Thread Prakash Borade
Friends tell me is hostgator.in server support django or not.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d54f8597-c7ac-46a4-a476-66fc3da30e83%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.