pinax

In a django web application, how do you give users their own subdomain?

我的梦境 提交于 2019-11-28 13:41:56
问题 I'm starting a new web app project using Django and Pinax. I want to be able to give my users unique domain names like Wordpress and other sites do : username.wordpress.com . I'm not sure how to approach this with Django, since the url parsing logic (in urls.py) starts with the url AFTER the domain name. More specifically, there will be multiple groups of users, each group having a unique name. Not sure that makes a difference, but I thought I should mention that. Is there some way I can

Could not import settings 'myproject.settings' (Is it on sys.path?): No module named pinax

落爺英雄遲暮 提交于 2019-11-28 07:02:41
I'm trying to get pinax working on WebFaction and having so many issues... [Sun Feb 19 20:01:20 2012] [error] [client 127.0.0.1] mod_wsgi (pid=22796): Exception occurred processing WSGI script '/home/pawesome/webapps/qtsocial/myproject.wsgi'. [Sun Feb 19 20:01:20 2012] [error] [client 127.0.0.1] Traceback (most recent call last): [Sun Feb 19 20:01:20 2012] [error] [client 127.0.0.1] File "/home/pawesome/webapps/qtsocial/lib/python2.6/django/core/handlers/wsgi.py", line 250, in __call__ [Sun Feb 19 20:01:20 2012] [error] [client 127.0.0.1] self.load_middleware() [Sun Feb 19 20:01:20 2012]

Enforce unique upload file names using django?

孤者浪人 提交于 2019-11-27 03:23:13
What's the best way to rename photos with a unique filename on the server as they are uploaded, using django? I want to make sure each name is used only once. Are there any pinax apps that can do this, perhaps with GUID? Nathan Use uuid. To tie that into your model see Django documentation for FileField upload_to. For example in your models.py define the following function: import uuid import os def get_file_path(instance, filename): ext = filename.split('.')[-1] filename = "%s.%s" % (uuid.uuid4(), ext) return os.path.join('uploads/logos', filename) Then, when defining your FileField

Enforce unique upload file names using django?

こ雲淡風輕ζ 提交于 2019-11-26 17:30:39
问题 What's the best way to rename photos with a unique filename on the server as they are uploaded, using django? I want to make sure each name is used only once. Are there any pinax apps that can do this, perhaps with GUID? 回答1: Use uuid. To tie that into your model see Django documentation for FileField upload_to. For example in your models.py define the following function: import uuid import os def get_file_path(instance, filename): ext = filename.split('.')[-1] filename = "%s.%s" % (uuid