Re: Serving static files (admin panel and others)

2014-12-13 Thread Muhammed Tüfekyapan
I find the problem. 


Problem was the file dir nginx looking for static file is different than I 
used for static file.

I changed the files location and it solved.


Thanks for response.

On Sunday, December 14, 2014 4:31:49 AM UTC+2, Florian Schweikert wrote:
>
> On 14/12/14 00:55, Muhammed Tüfekyapan wrote: 
> > I try many things to serve .css files but I can't do that. How can i 
> > serve .css and .js files in Django 1.7? 
> > 
> > 
> > I typed django manage.py collectstatic but still my admin panel don't 
> > load css. 
> > 
> > What can i do? 
>
> did you follow the howto in the documentation? 
>
> https://docs.djangoproject.com/en/1.7/howto/static-files/ 
>
> -- Florian 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1477ffe3-5d07-4556-b125-c6b5f2ad52f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django template auto format tool?

2014-12-13 Thread Abraham Varricatt
Hello,

Is there any command-line based tool which would let one auto-format Django 
template files? Ideally, the tool should also be used to format HTML, CSS 
and .JS files too. 

I've recently inherited a bad-looking code base and want to clean it up. 
Have heard of the PEP8 autoformatter, but that just works for Python files, 
right?

-Abraham V.

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6ce7098d-5ab0-4223-8488-35f6688adc9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Serving static files (admin panel and others)

2014-12-13 Thread Florian Schweikert
On 14/12/14 00:55, Muhammed Tüfekyapan wrote:
> I try many things to serve .css files but I can't do that. How can i
> serve .css and .js files in Django 1.7?
> 
> 
> I typed django manage.py collectstatic but still my admin panel don't
> load css.
> 
> What can i do?

did you follow the howto in the documentation?

https://docs.djangoproject.com/en/1.7/howto/static-files/

-- Florian

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/548CF669.4050907%40ist-total.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Serving static files (admin panel and others)

2014-12-13 Thread Muhammed Tüfekyapan
Hello everyone,


I try many things to serve .css files but I can't do that. How can i serve 
.css and .js files in Django 1.7?


I typed django manage.py collectstatic but still my admin panel don't load 
css.

What can i do?



Best.

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a9616735-fd97-40ef-8b39-976f2b4974c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to toggle/set boolean-values of multiple records in the Admin?

2014-12-13 Thread inoyon artlover KLANGRAUSCH
Tried something like this, but it doesn't work...

class ZipCodeAdmin(admin.ModelAdmin):
list_display = ['zipcode', 'city',  'active']
ordering = ['zipcode']

def toggle_status(self, request, queryset):
for item in queryset:
item.active = True
item.save()
return item


Am Samstag, 13. Dezember 2014 23:00:04 UTC+1 schrieb inoyon artlover 
KLANGRAUSCH:
>
> Hi there, 
>
> my model is:
>
> class ZipCode(models.Model):
> zipcode = models.CharField(max_length=5)
> city = models.CharField(max_length=255)
> active = models.BooleanField(default=False)
>
> I would like to mange the 'active' status of some entries in the admin by 
> selecting multiple.
> For example: I select 20 entries and than toggle or set the 'active' 
> status to True/False.
>
> Many thanks in advance. Cheers :)
>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/35a1d744-9763-46d7-8bae-657aefe8cc5a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need to search through several tables using one model

2014-12-13 Thread Damjan Dimitrioski
The search filter above the change list view template, there is a button
named search I think, I think it's need to overriden in order to implement
custom model or something.

On Sat, Dec 13, 2014 at 11:06 PM, Vijay Khemlani  wrote:
>
> What search button are you talking about?
>
> On Sat, Dec 13, 2014 at 2:23 PM, Alon Nisser  wrote:
>>
>> You could also create a model that foreign keys to all the relevant
>> models, and filter on that..
>> Buy first you need to clarify (for your self..) The exact use case: is it
>> search? if so better use haystack with some search backend (elasticsearch
>> would be a great choice), Is it to choose something in a form? something
>> else?
>>
>> The technical details should be derived from the problem you are trying
>> to solve..
>>
>> On Friday, December 12, 2014 5:09:30 PM UTC+2, Damjan Dimitrioski wrote:
>>>
>>> Hi,
>>>
>>> Is there a way to make a model that links several db tables in one
>>> model, so that can be used in a change list view ?
>>> Most importantly, I need to be able to use the search field, can this be
>>> accomplished ?
>>>
>>> Regards.
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/235267f4-1851-4464-9426-b63dc074d671%40googlegroups.com
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/oaInfa9o4Js/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALn3ei0RSv4RuAyp%2BBhk5c9Qi4riF%3DFF3VXVQ_cr1rnuAxBs2g%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: Need to search through several tables using one model

2014-12-13 Thread Vijay Khemlani
What search button are you talking about?

On Sat, Dec 13, 2014 at 2:23 PM, Alon Nisser  wrote:
>
> You could also create a model that foreign keys to all the relevant
> models, and filter on that..
> Buy first you need to clarify (for your self..) The exact use case: is it
> search? if so better use haystack with some search backend (elasticsearch
> would be a great choice), Is it to choose something in a form? something
> else?
>
> The technical details should be derived from the problem you are trying to
> solve..
>
> On Friday, December 12, 2014 5:09:30 PM UTC+2, Damjan Dimitrioski wrote:
>>
>> Hi,
>>
>> Is there a way to make a model that links several db tables in one model,
>> so that can be used in a change list view ?
>> Most importantly, I need to be able to use the search field, can this be
>> accomplished ?
>>
>> Regards.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/235267f4-1851-4464-9426-b63dc074d671%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei0RSv4RuAyp%2BBhk5c9Qi4riF%3DFF3VXVQ_cr1rnuAxBs2g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to toggle/set boolean-values of multiple records in the Admin?

2014-12-13 Thread inoyon artlover KLANGRAUSCH
Hi there, 

my model is:

class ZipCode(models.Model):
zipcode = models.CharField(max_length=5)
city = models.CharField(max_length=255)
active = models.BooleanField(default=False)

I would like to mange the 'active' status of some entries in the admin by 
selecting multiple.
For example: I select 20 entries and than toggle or set the 'active' status 
to True/False.

Many thanks in advance. Cheers :)

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8b5b43d6-9c31-4f8f-9765-d1b86e655dcd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django + Raspberry PI

2014-12-13 Thread albrnick
A bit dated, but since this page came up when I ran into the same issue, 
thought I'd post my fix.

Pretty much I turned off DEBUG in the settings.py file, and the performance 
is fine now = )

Best Wishes,
 -Nick

On Friday, March 1, 2013 10:58:28 AM UTC-5, Nicolas Emiliani wrote:
>
> Hey guys!
>
> Has anyone tried to run django + sqlite on a raspberry pi ? Any 
> performance issues ?
>
> I'm about to start an app that provides a restful api and has to run on 
> RPI, it's going
> to manage an automation service, so load is going to be pretty low.
>
> Cheers.
>
> -- 
> Nicolas Emiliani
>
> Lo unico instantaneo en la vida es el cafe, y es bien feo. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f3d96721-b860-49d7-97de-5ecaa088ec3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django 1.7: How to migrate data between two external apps

2014-12-13 Thread John-Scott
Say I decided to switch from a third party app foo-tags to app bar-tags. 
Their Tag models are mostly identical so I just need to move the data from 
foo-tag to bar-tag. Since I don't control their migrations, I'd need to 
create a migration in one of my own apps:

./manage.py makemigrations my_app --empty

In this migration I'd need to explicitly list the dependencies on these 
external apps (otherwise was getting errors that the foo and bar apps were 
not available in the app registry):

# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations

def migrate_tags(apps, schema_editor):
FooTag = apps.get_model('foo_tag', 'FooTag')
BarTag = apps.get_model('bar_tag', 'BarTag')
for old_tag in FooTag.objects.all():
new_tag = BarTag.objects.create(name=old_tag.name)

class Migration(migrations.Migration):
dependencies = [
('my_app', '0001_initial'),
('foo_tag', '0001_initial'),
('bar_tag', '0001_initial'),
]

operations = [
migrations.RunPython(migrate_tags)
]


The migration itself works as expected. However if I now remove foo_tag 
from INSTALLED_APPS, Django will now give an error:

KeyError: "Migration my_app.0002_auto_20141212_1951 dependencies reference 
nonexistent parent node ('foo_tag', '0001_initial')"

What's the correct way to handle migrating data between 3rd party apps 
where one of the apps is eventually removed?

Thanks,
John-Scott

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d60b5693-408f-4ce4-8219-70d1e6c48f51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need to search through several tables using one model

2014-12-13 Thread Alon Nisser
You could also create a model that foreign keys to all the relevant models, 
and filter on that.. 
Buy first you need to clarify (for your self..) The exact use case: is it 
search? if so better use haystack with some search backend (elasticsearch 
would be a great choice), Is it to choose something in a form? something 
else? 

The technical details should be derived from the problem you are trying to 
solve.. 

On Friday, December 12, 2014 5:09:30 PM UTC+2, Damjan Dimitrioski wrote:
>
> Hi,
>
> Is there a way to make a model that links several db tables in one model, 
> so that can be used in a change list view ?
> Most importantly, I need to be able to use the search field, can this be 
> accomplished ?
>
> Regards.
>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/235267f4-1851-4464-9426-b63dc074d671%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-compressor manifest.json problem on Heroku

2014-12-13 Thread Guy Tamir
I haven't configured django caching, how do I do that?

Also - CachedS3BotoStorage is this:

from django.core.files.storage import get_storage_class
from storages.backends.s3boto import S3BotoStorage


from django.core.files.base import File


class CachedS3BotoStorage(S3BotoStorage):
"""
S3 storage backend that saves the files locally, too.
"""
def __init__(self, *args, **kwargs):
super(CachedS3BotoStorage, self).__init__(*args, **kwargs)
self.local_storage = get_storage_class(
"compressor.storage.CompressorFileStorage")()


def save(self, name, content):
name = super(CachedS3BotoStorage, self).save(name, content)
self.local_storage._save(name, content)
return name


On Friday, December 12, 2014 5:09:16 PM UTC+2, Collin Anderson wrote:
>
> Hi,
>
> Do you have django caching configured? If not, then caching will only be 
> per-process and each process will need to fetch the information. (I'm 
> assuming CachedS3BotoStorage uses django's cache.)
>
> Collin
>
> On Wednesday, December 10, 2014 11:05:35 AM UTC-5, Guy Tamir wrote:
>
> Hey all,
>
> I'm trying to add django-compressor into my app.
> I'm deploying to Heroku.
>
> This is the code in my Settings file
> AWS_QUERYSTRING_AUTH = False
> AWS_STORAGE_BUCKET_NAME = os.environ.get('BUCKET_NAME')
>
> conn = S3Connection(AWS_ACCESS_KEY, AWS_SECRET_KEY,host="
> s3-us-west-1.amazonaws.com")
> STATIC_ROOT = 'static'
> COMPRESS_ROOT = 'static'
>
>
>
> COMPRESS_CSS_FILTERS = ['compressor.filters.yuglify.YUglifyCSSFilter',
> 'compressor.filters.cssmin.CSSMinFilter']
> COMPRESS_JS_FILTERS = ['compressor.filters.jsmin.JSMinFilter'] 
> #,'compressor.filters.jsmin.SlimItFilter'
> COMPRESS_OUTPUT_DIR = 'compressed'
> COMPRESS_CSS_BACKEND = 'django_compressor.css.CssCompressor'
> COMPRESS_JS_BACKEND = 'django_compressor.js.JsCompressor'
> COMPRESS_OFFLINE = True
> COMPRESS_ENABLED = True
>
>
> if DEBUG:
> STATIC_URL = '/static/'
> else:
> AWS_S3_CUSTOM_DOMAIN = os.environ.get('COMPRESS_URL') # cdn.test.com
> STATIC_URL =  'http://' + AWS_S3_CUSTOM_DOMAIN + '/'
> STATICFILES_STORAGE = 'myapp.CachedS3BotoStorage.CachedS3BotoStorage'
> COMPRESS_STORAGE = 'myapp.CachedS3BotoStorage.CachedS3BotoStorage'
>
>
> COMPRESS_URL = STATIC_URL
>
>
> I ran the compress command locally and then deployed to Heroku.
> When I see my deployed pages I can see in the source files that the 
> browser is using the compressed css and js file like expected.
>
> My problem is that when I see my logs from Heroku, each time that I 
> refresh a page, it seems like Heroku goes and fetches the manifest.json 
> file from my S3 bucket.
> This obviously slows down the requests..
>
> Logs from Heroku:
> 2014-12-10T16:01:14.087225+00:00 app[web.1]: DEBUG:boto:Token: None
> 2014-12-10T16:01:14.086183+00:00 app[web.1]: DEBUG:boto:auth
> _path=/test-dollarsocial/compressed/manifest.json
> 2014-12-10T16:01:14.137618+00:00 heroku[router]: at=info method=GET path=
> "/login/" host=test-dollar-social.herokuapp.com request_id=bede0d95-e9b6-
> 4453-95b3-438606fc7e62 fwd="93.172.158.119" dyno=web.1 connect=1ms service
> =194ms status=200 bytes=13248
> 2014-12-10T16:01:14.051410+00:00 app[web.1]: DEBUG:boto:Using secret key 
> provided by client.
> 2014-12-10T16:01:14.051322+00:00 app[web.1]: DEBUG:boto:Using access key 
> provided by client.
> 2014-12-10T16:01:14.051990+00:00 app[web.1]: DEBUG:boto:path=/compressed/
> manifest.json
> 2014-12-10T16:01:14.052126+00:00 app[web.1]: DEBUG:boto:auth_path=
> /test-dollarsocial/compressed/manifest.json
> 2014-12-10T16:01:14.052405+00:00 app[web.1]: DEBUG:boto:Path: /compressed/
> manifest.json
> 2014-12-10T16:01:14.052316+00:00 app[web.1]: DEBUG:boto:Method: HEAD
> 2014-12-10T16:01:14.052490+00:00 app[web.1]: DEBUG:boto:Data:
> 2014-12-10T16:01:14.052605+00:00 app[web.1]: DEBUG:boto:Headers: {}
> 2014-12-10T16:01:14.052734+00:00 app[web.1]: DEBUG:boto:Host: test-
> dollarsocial.s3.amazonaws.com
> 2014-12-10T16:01:14.052828+00:00 app[web.1]: DEBUG:boto:Params: {}
> 2014-12-10T16:01:14.052970+00:00 app[web.1]: DEBUG:boto:establishing 
> HTTPS connection: host=test-dollarsocial.s3.amazonaws.com, kwargs={
> 'timeout': 70}
> 2014-12-10T16:01:14.053082+00:00 app[web.1]: DEBUG:boto:Token: None
> 2014-12-10T16:01:14.053224+00:00 app[web.1]: DEBUG:boto:StringToSign:
> 2014-12-10T16:01:14.053227+00:00 app[web.1]: HEAD
> 2014-12-10T16:01:14.053228+00:00 app[web.1]:
> 2014-12-10T16:01:14.053230+00:00 app[web.1]:
> 2014-12-10T16:01:14.053231+00:00 app[web.1]: Wed, 10 Dec 2014 16:01:14 GMT
> 2014-12-10T16:01:14.053233+00:00 app[web.1]: /test-dollarsocial/compressed
> /manifest.json
> 2014-12-10T16:01:14.085443+00:00 app[web.1]: DEBUG:boto:path=/compressed/
> manifest.json
> 2014-12-10T16:01:14.086354+00:00 app[web.1]: DEBUG:boto:Method: HEAD
> 2014-12-10T16:01:14.086473+00:00 app[web.1]: DEBUG:boto:Path: /compressed/
> manifest.json
> 2014-12-10T16:01:14.086576+00:00 app[web.1]: DEBUG:boto:Data:
> 

Re: Need to search through several tables using one model

2014-12-13 Thread Damjan Dimitrioski
Can I override the search button, so it will call the custom raw query ?
And if yes, can you show me how to override it, please ?

On Friday, December 12, 2014 5:41:08 PM UTC+1, Vijay Khemlani wrote:
>
> Just using the ORM I think not
>
> You could
>
> 1. Make a raw sql query using UNIONs for each table
>
> 2. Make a common superclass for the models with th search field
>
> 3. Use an external search engine (elasticsearch, etc) and store the 
> entries for the required models under the same index.
>
> Finally, you could just query each model separately
>
> On Fri, Dec 12, 2014 at 12:09 PM, Damjan Dimitrioski <
> damjandi...@gmail.com > wrote:
>>
>> Hi,
>>
>> Is there a way to make a model that links several db tables in one model, 
>> so that can be used in a change list view ?
>> Most importantly, I need to be able to use the search field, can this be 
>> accomplished ?
>>
>> Regards.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/0fc05894-fb00-40d5-b1d9-68daa5c82841%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7abe-ca5c-4823-82f7-6dc0ebdd19d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Seeking for advise on usage MySQL together with MongoDB

2014-12-13 Thread Tom Christie
Hi Cal,

> DRF has it's own problems and (again imho) does not solve the problems it 
was originally designed to fix. Attempting to build anything beyond "out of 
the box CRUD" requires hacky/unclean workarounds, with most of your time 
spent fighting against the shortcomings of DRF rather than working with it.

I'm slightly at a loss to understand what set of pain points could have 
left you with that impression, but it'd be helpful to get a better idea.

Perhaps some of the awkwardnesses in 2.x serializers that have been 
addressed with the 3.0 release?
Perhaps a misunderstanding that viewsets/routers are intended to be the 
canonical way to use REST framework?

The 'build anything beyond "out of the box CRUD"' comment is particularly 
surprising to me because of all the work I do in REST framework *none* of 
it is CRUD, and the design decisions in REST framework are very explicitly 
towards it being an agnostic Web API toolkit, that just *happens* to also 
have easy support if basic CRUD stuff *does* happen to be what you want. Eg:

* Validation that's cleanly decoupled from Django's ORM, but that can also 
work seemlessly with it if that's what you need.
* Works just fine with regular views, but has a minimal set of pre-provided 
generic views if simple CRUD operations are what you need.
* Viewsets and routers for projects that fit well with a very standard URL 
style, or drop down to views and explicit URL conf otherwise.

I don't want to jump on and just criticize the view point you've presented 
- whatever it is that's left you with that impression is clearly a useful 
data point for me.

What other API toolkits would you look towards as more mature, well 
supported, nicely designed solutions?
Which shortcomings were you fighting against, and what do you think the 
project should be doing differently?

Cheers,

  Tom

On Friday, 12 December 2014 18:05:02 UTC, Cal Leeming wrote:
>
> Hi Collin, 
>
> Just a few comments;
>
> On Fri, Dec 12, 2014 at 5:42 PM, Collin Anderson  > wrote:
>>
>> Hi,
>>
>> Re: the hacker news thread, (sorry for getting a little off topic,) I 
>> just wanted to mention a few places where we've tried to improve some of 
>> those things recently:
>> - The ORM is still slow, but we've added prefetch_related() and improved 
>> select_related() which allows you do use fewer queries. 
>>
> - We've pulled out some of components into separate projects: 
>> django-localflavor, django-contrib-comments, django-formtools, and I 
>> imagine more in the future.
>> - You can now use custom user models.
>>
>
> Custom models is (imho) still unnecessarily complex, something as simple 
> as not requiring a username field requires a lot of work. There have been 
> several instances where migrations had to be scraped due to weird edge 
> cases with custom user models.
>  
>
>> - We're working on an official public API for the model._meta internals 
>> and working towards components only using that. It also means it will be 
>> easier to use non-django models in the admin.
>> - We're working on de-coupling django templates, allowing them to be used 
>> on their own, and making it much easier to use other template engines like 
>> Jinja2.
>> - There's are also quite a lot of people using django-rest-framework for 
>> creating REST apis, which was one thing the thread said django was not good 
>> at.
>>
>
> DRF has it's own problems and (again imho) does not solve the problems it 
> was originally designed to fix. Attempting to build anything beyond "out of 
> the box CRUD" requires hacky/unclean workarounds, with most of your time 
> spent fighting against the shortcomings of DRF rather than working with it.
>
> Building a clean RESTful API in Django is possible, but it requires a lot 
> of custom libs/hacks to make it work properly. For example, you have to 
> create your own method dispatcher/router, which in turn breaks 
> class/dispatch decorators due to the way those are loaded. Or you could 
> throw it all into a single class and split out the functionality using 
> get/post/put, but this is really unclean because each HTTP method is 
> essentially it's own view. Another way is to not use decorators of course. 
> Then you have partial form handling, which I already touched on in another 
> thread [1], so I won't repeat here.
>
> These are just a few examples of annoyances which hinder productivity. 
> That being said, Django is still quite good at a lot of things, and again 
> it comes down to "the right tool for the job". It's all about knowing the 
> strength/weaknesses of your options, and making an appropriate choice based 
> on your use case, making sacrifices dependant on your needs etc.
>
> [1] https://groups.google.com/forum/#!topic/django-users/pZCk4cFVcSI
>
>
>
>> Collin
>>
>> On Wednesday, December 10, 2014 3:21:07 PM UTC-5, Cal Leeming wrote:
>>>
>>> If you're using Django, then there isn't really an alternative, as it's 
>>> really a key selling point of