get Django url content with urllib2
Hello everyone. I try: content = urllib2.urlopen('http://localhost:8080/').read() from inside some Django view(function) and http://localhost:8080/ is same Django server. This command do not give me any answer but hang on. But if url is foreign it is working. Is there some cycle problem? Is it possible to get some page from inside Django using foreign tools(curl, urllib)? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
request in model
I am new in Django. I am looking for a solution for my problem. I want to have a base model class inheriting all other model classes from that class. In the base model class I want to check some permissions for users. So, need pass request to model class so that to have request.user. Is it possible? Sorry for the obscure explanation, I just want to know whether it is possible to go this way. -- Oh, by the way, which one's Pink? -- Pink Floyd -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django 1.3 - Question about static files
On 26-03-2011, Sandro Dutra wrote: >Hello everyone! >I'm using Python 2.7.x with Django 1.3 and I've some questions about >the new way to set the static files for the dev server. >abspath = lambda *p: os.path.abspath(os.path.join(*p)) >PROJECT_ROOT = abspath(os.path.dirname(__file__)) >(...) >MEDIA_ROOT = abspath(PROJECT_ROOT, 'media') >MEDIA_URL = '/media/' >ADMIN_MEDIA_PREFIX = '/media/admin/' >STATIC_ROOT = abspath(PROJECT_ROOT, 'static') >STATIC_URL = '/static/' >STATICFILES_DIRS = ( >abspath(STATIC_ROOT, 'css'), >abspath(STATIC_ROOT, 'javascript'), >abspath(STATIC_ROOT, 'images'), >) I had a similar problem. I do not remember, but what I have in my project now it is commented out STATIC_ROOT. If I uncomment STATIC_ROOT it do not work. STATIC_ROOT_FILES = os.path.join(os.path.dirname(__file__), 'static').replace('\\', '/') #STATIC_ROOT = STATIC_ROOT_FILES STATICFILES_DIRS = ( STATIC_ROOT_FILES, ) STATIC_URL = "/static/" -- Practical politics consists in ignoring facts. -- Henry Adams -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.