Dictionary in admin interface
I want to manage a dictionary inline over the admin interface. These are my models. What I got working is of course a separated management of request and dictionary. But I want to add key value pairs in the request admin interface with a TabularInline. Do I have to skip the dictionary in some way or what do I have to do? class Dictionary(models.Model): name = models.CharField(max_length=255) class KeyValuePair(models.Model): container = models.ForeignKey(Dictionary, db_index=True) key = models.CharField(max_length=240, db_index=True) value = models.CharField(max_length=240, db_index=True) class Request(models.Model): params = models.ForeignKey(Dictionary, related_name="params_map", blank=True, null=True) -- 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/f57a2c01-95c1-4fdc-9a9c-3ed4000c0453%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Django accepting other applications ports
I have two applications on my apache. Why is my Django application running accepting the connection also of port ? Listen 8787 The other application: Listen -- 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/f512ca44-b7fc-4e26-8c56-7cb325e1f6dd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Django accepting other applications ports
*backend.conf* Listen 8787 WSGIScriptAlias / /var/www/html/backend/API/wsgi.py WSGIPythonPath /var/www/html/backend:/var/www/html/backend/venv/lib/python2.7/site-packages WSGIPassAuthorization On DocumentRoot /var/www/html/backend Require all granted ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined *website.conf* Listen DocumentRoot /var/www/html/website Options FollowSymLinks AllowOverride All Options Indexes FollowSymLinks MultiViews AllowOverride All Order Allow,Deny Allow from all ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined Am Mittwoch, 25. März 2015 20:22:05 UTC+1 schrieb Gergely Polonkai: > > Hello, > > Please share the rest of this Apache config; from what you copied, it's > impossible to tell. > > Best, > Gergely > On 25 Mar 2015 17:12, "Sven Mäurer" > > wrote: > >> I have two applications on my apache. Why is my Django application >> running accepting the connection also of port ? >> >> Listen 8787 >> >> >> >> The other application: >> >> Listen >> >> >> -- >> 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/f512ca44-b7fc-4e26-8c56-7cb325e1f6dd%40googlegroups.com >> >> <https://groups.google.com/d/msgid/django-users/f512ca44-b7fc-4e26-8c56-7cb325e1f6dd%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> 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/fdad8670-4d98-474e-ae33-6c719fcd4b75%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Django accepting other applications ports
Ohh thanks. You have saved at least 4 hours of my sleep, 10 coffees and a very bad mood! Am Mittwoch, 25. März 2015 21:57:19 UTC+1 schrieb Stephen Butler: > > On Wed, Mar 25, 2015 at 2:27 PM, Sven Mäurer > wrote: > > backend.conf > > > > Listen 8787 > > > > WSGIScriptAlias / /var/www/html/backend/API/wsgi.py > > WSGIPythonPath > > > /var/www/html/backend:/var/www/html/backend/venv/lib/python2.7/site-packages > > > WSGIPassAuthorization On > > WSGIScriptAlias belongs in your VirtualHost, not at the server config > level. Also... > > > > > DocumentRoot /var/www/html/backend > > > > > > Require all granted > > > > > > > > ErrorLog ${APACHE_LOG_DIR}/error.log > > CustomLog ${APACHE_LOG_DIR}/access.log combined > > > > > > This is dangerous. You should never set your DocumentRoot to be where > your code is. A minor misconfiguration in your apache setup could > expose all your source code! Instead set your document root to > something empty (or maybe containing your static files directory) and > do this: > > WSGIPythonPath > /var/www/python/backend:/var/www/python/venv/lib/python2.7/site-packages > > > DocumentRoot /var/www/html > WSGIScriptAlias / /var/www/python/API/wsgi.py > > > Order deny,allow > Allow from all > > > > -- 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/4909fb3a-123e-440b-bf19-787b96a0618c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
How to mock a model backend
In my model backend I usually call an external service which returns me an user that is saved and returned. When I don't have credentials I want to mock the backend for some test cases. In the setup of each test case I am calling the login method where CRED contains the real credentials or mock credentials. This can be determined by are_credentials_given. def are_credentials_given(): return not os.path.isfile(os.path.join(BASE_DIR, 'settings/credentials')) def login(self): u = User.objects.create(id=CRED['ID'], is_staff=True) u.save() token, c = Token.objects.get_or_create(user=u) if c: token.save() self.client = APIClient() self.client.credentials(HTTP_AUTHORIZATION='Token ' + token.key) self.client.login(username=CRED['USERNAME'], password=CRED['PASSWORD']) -- 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/894d8e22-b448-41fc-bd1b-a82a2a35db8a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.