Re: Sponsor subdomain pointing to part of our Django site?

2018-06-04 Thread James Schneider
On Mon, Jun 4, 2018, 12:37 PM Melvyn Sopacua  wrote:

> On maandag 4 juni 2018 20:40:03 CEST Richard Brockie wrote:
>
> > On Mon, Jun 4, 2018 at 9:01 PM Melvyn Sopacua 
> wrote:
>
> > > This isn't a problem. Neither url nor reverse is capable of returning
> URLs
>
> > > with hostnames, at least not that I'm aware of. Only
> django.contrib.site
>
> > > <
> https://docs.djangoproject.com/en/2.0/ref/contrib/sites/#getting-the-curr
>
> > > ent-domain-for-display> module can do this for out-of-band
> communications.
>
> >
>
> > Aha - there's an error in how I posed the question. I was confusing the
> url
>
> > and reverse() outputs with the links as interpreted by a browser.
>
> >
>
> > If http_host is ''subdomain.sponsor.url" we are at the site using the
>
> > sponsor's alias which maps to a unique "/year/slug/" on our site (just
> one
>
> > of many). In this case, we require the output of {% url %} and reverse()
> to
>
> > have 2 possibilities:
>
> >
>
> > 1. Normal operation (with our default http_host): returns the full path:
>
> > "/year/slug/some/more/path/"
>
> > 2. Sponsor http_host: returns a trimmed path: "/some/more/path". Here
>
> > "/year/slug" is suppressed as it is built into the
>
> > ''subdomain.sponsor.url" alias.
>
> >
>
> > I hope this clarifies what we think we need to do
>
>
>
> Aha! Now I get it! This should be solveable at the WSGI layer:
>
>
>
> PATH_INFO
>
> The remainder of the request URL's "path", designating the virtual
> "location" of the request's target within the application. This may be an
> empty string, if the request URL targets the application root and does not
> have a trailing slash.
>
>
>
> See https://www.python.org/dev/peps/pep-0333/
>
>
>
> A URL rewrite or proxy at the webserver level should work as well. It may
> take a bit of experimenting.
>


Would URL rewrites solve this? How does that affect URL's generated in the
template?

It sounds like a separate 'site' with the sites framework is needed, along
with a modified urls.py that does not include the year and slug in the path.

Your might be able to use the existing urls.py by making the year and slug
optional in the regex. When using the sponsored site, you would pass along
extra context to the URL dispatcher that includes the year/slug or whatever
data is being assumed by the usage of the sponsor URL.

Basically, you need two different paths to the same resource, dependent on
the domain name or site in question.

Why not just leave the year and slug in and save yourself the extra work?
Is the vanity path a requirement or just 'nice to have'?

-James

-- 
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/CA%2Be%2BciVucZjzfOxfRwwJijUc%2BxpNVgJWJO%3Dc%2Bg_Ygo-t3tXdcQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: App not Defined - Getting Started

2018-06-04 Thread Priya
Hi Jamie,

I think you should put single quotes inside include() which expects a path
for your apps(polls) urls.py. So try-

path('polls/',include('polls.urls'))

Hope this helps.

On Tue, 5 Jun 2018, 2:59 a.m. Jaime Escobar,  wrote:

> Hi,
> I am a completely beginner in django and also python programming. I am
> trying to follow the online documentation tutorial in which a poll website
> is created, but just running the server after created the polls it throws
> the error "name 'polls' is not defined".
>
> Can you help me?
>
>
> Unhandled exception in thread started by  check_errors..wrapper at 0x7feeeb74ab70>
> Traceback (most recent call last):
>   File
> "/home/jaime/.local/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 225, in wrapper
> fn(*args, **kwargs)
>   File
> "/home/jaime/.local/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
> line 120, in inner_run
> self.check(display_num_errors=True)
>   File
> "/home/jaime/.local/lib/python3.6/site-packages/django/core/management/base.py",
> line 364, in check
> include_deployment_checks=include_deployment_checks,
>   File
> "/home/jaime/.local/lib/python3.6/site-packages/django/core/management/base.py",
> line 351, in _run_checks
> return checks.run_checks(**kwargs)
>   File
> "/home/jaime/.local/lib/python3.6/site-packages/django/core/checks/registry.py",
> line 73, in run_checks
> new_errors = check(app_configs=app_configs)
>   File
> "/home/jaime/.local/lib/python3.6/site-packages/django/core/checks/urls.py",
> line 40, in check_url_namespaces_unique
> all_namespaces = _load_all_namespaces(resolver)
>   File
> "/home/jaime/.local/lib/python3.6/site-packages/django/core/checks/urls.py",
> line 57, in _load_all_namespaces
> url_patterns = getattr(resolver, 'url_patterns', [])
>   File
> "/home/jaime/.local/lib/python3.6/site-packages/django/utils/functional.py",
> line 36, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File
> "/home/jaime/.local/lib/python3.6/site-packages/django/urls/resolvers.py",
> line 540, in url_patterns
> patterns = getattr(self.urlconf_module, "urlpatterns",
> self.urlconf_module)
>   File
> "/home/jaime/.local/lib/python3.6/site-packages/django/utils/functional.py",
> line 36, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File
> "/home/jaime/.local/lib/python3.6/site-packages/django/urls/resolvers.py",
> line 533, in urlconf_module
> return import_module(self.urlconf_name)
>   File "/usr/lib/python3.6/importlib/__init__.py", line 126, in
> import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 994, in _gcd_import
>   File "", line 971, in _find_and_load
>   File "", line 955, in
> _find_and_load_unlocked
>   File "", line 665, in _load_unlocked
>   File "", line 678, in exec_module
>   File "", line 219, in
> _call_with_frames_removed
>   File "/home/jaime/Projects/Django/mysite/mysite/urls.py", line 20, in
> 
> path('polls/',include(polls.urls)),
> NameError: name 'polls' is not defined
>
> --
> 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/df3c68c4-aa2a-498d-a1ed-840a31acf7a2%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/CAPBHpYD2bvojRHMpJKpyG7PMcvNDzyOr%3Dd3dFtQ729K_NnPUiA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: error: can not import the name 'path'

2018-06-04 Thread Aphiso Media
Whats version are you using? Im on mobile so i cant open urls.py.

If you're using a version earlier than 2.0 you need to use url instead of
path.

Do you have from django.urls import path?

On Mon, Jun 4, 2018, 4:29 PM anguboy  wrote:

> i am new in django, so in my first app ,am stack at mapping the URL and I
> get an error that can not import name 'path' ,,which is in the tmn(my_app)
> folder , please help
>
> --
> 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/88ca007c-c716-4050-a7ce-7bb1b7214fe0%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/CAJiup7FSUuROtUXyArQqVgFTfOSnf9oBn-zY6TFWyttib%2B5g-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Generating server-side off-line HTML of Django pages ...

2018-06-04 Thread Bernd Wechner
Thanks Melvyn, looks exactly like what I wanted! Will investigate. I had a 
feeling this could not be a novel or unique use case.

Regards,

Bernd.

On Monday, 4 June 2018 20:09:25 UTC+10, Melvyn Sopacua wrote:
>
> On maandag 4 juni 2018 08:00:08 CEST Bernd Wechner wrote:
>
> > Say I have a page on my Django website (because I do) that I would like 
> to
>
> > take a snapshot of on an automated basis on the server itself with a
>
> > crontab say. I imagine writing a small python script that I could run, 
> that
>
> > loads Django, a settings file, knows a URL and has a way of saying "give 
> me
>
> > the rendered page for that URL please" and save it in a file.
>
>  
>
> ...
>
>  
>
> > a) there's a canonical way to do this already that can be recommended
>
>  
>
> Yep. The test client 
> ...
>  
> if your template uses request related information (like logged in user). 
> The cheaper method is something like this code 
> ,
>  
> but this only renders the template and you'd have to provide a context so 
> view code is bypassed.
>
>  
>
> -- 
>
> Melvyn Sopacua
>

-- 
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/850bfcaa-0518-48ef-a827-087100efda92%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


error: can not import the name 'path'

2018-06-04 Thread anguboy
i am new in django, so in my first app ,am stack at mapping the URL and I 
get an error that can not import name 'path' ,,which is in the tmn(my_app) 
folder , please help

-- 
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/88ca007c-c716-4050-a7ce-7bb1b7214fe0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
from django.conf.urls import path
from django.contrib import admin
from . import views
urlpatterns = [
path('index/',views.index, name="index"),
]

App not Defined - Getting Started

2018-06-04 Thread Jaime Escobar
Hi, 
I am a completely beginner in django and also python programming. I am 
trying to follow the online documentation tutorial in which a poll website 
is created, but just running the server after created the polls it throws 
the error "name 'polls' is not defined".

Can you help me?


Unhandled exception in thread started by .wrapper at 0x7feeeb74ab70>
Traceback (most recent call last):
  File 
"/home/jaime/.local/lib/python3.6/site-packages/django/utils/autoreload.py", 
line 225, in wrapper
fn(*args, **kwargs)
  File 
"/home/jaime/.local/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
 
line 120, in inner_run
self.check(display_num_errors=True)
  File 
"/home/jaime/.local/lib/python3.6/site-packages/django/core/management/base.py",
 
line 364, in check
include_deployment_checks=include_deployment_checks,
  File 
"/home/jaime/.local/lib/python3.6/site-packages/django/core/management/base.py",
 
line 351, in _run_checks
return checks.run_checks(**kwargs)
  File 
"/home/jaime/.local/lib/python3.6/site-packages/django/core/checks/registry.py",
 
line 73, in run_checks
new_errors = check(app_configs=app_configs)
  File 
"/home/jaime/.local/lib/python3.6/site-packages/django/core/checks/urls.py", 
line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
  File 
"/home/jaime/.local/lib/python3.6/site-packages/django/core/checks/urls.py", 
line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
  File 
"/home/jaime/.local/lib/python3.6/site-packages/django/utils/functional.py", 
line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File 
"/home/jaime/.local/lib/python3.6/site-packages/django/urls/resolvers.py", 
line 540, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", 
self.urlconf_module)
  File 
"/home/jaime/.local/lib/python3.6/site-packages/django/utils/functional.py", 
line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File 
"/home/jaime/.local/lib/python3.6/site-packages/django/urls/resolvers.py", 
line 533, in urlconf_module
return import_module(self.urlconf_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in 
import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 994, in _gcd_import
  File "", line 971, in _find_and_load
  File "", line 955, in _find_and_load_unlocked
  File "", line 665, in _load_unlocked
  File "", line 678, in exec_module
  File "", line 219, in 
_call_with_frames_removed
  File "/home/jaime/Projects/Django/mysite/mysite/urls.py", line 20, in 

path('polls/',include(polls.urls)),
NameError: name 'polls' is not defined

-- 
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/df3c68c4-aa2a-498d-a1ed-840a31acf7a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Best way to add an image from a filefield to django 2.0 admin?

2018-06-04 Thread Mark Phillips
I have a Document model that uploads an image. I have a DocumentMetaData
model with a JSON field where I "crud" metadata for the documents in the
Document model.

I would like to add the image of the document in the Document model to the
change form of the DocumentMetaData model in the admin. How do I do it? Do
I have to override the admin/change_form.html for the DocumentMetaData
model?

Thanks!

Mark

-- 
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/CAEqej2PYNudeSWa5CY934m8kMWO%3Dhcpj4%3DxQud9C-wZCHoaS4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sponsor subdomain pointing to part of our Django site?

2018-06-04 Thread Melvyn Sopacua
On maandag 4 juni 2018 20:40:03 CEST Richard Brockie wrote:
> On Mon, Jun 4, 2018 at 9:01 PM Melvyn Sopacua  wrote:
> > This isn't a problem. Neither url nor reverse is capable of returning URLs
> > with hostnames, at least not that I'm aware of. Only django.contrib.site
> >  > ent-domain-for-display> module can do this for out-of-band communications.
> 
> Aha - there's an error in how I posed the question. I was confusing the url
> and reverse() outputs with the links as interpreted by a browser.
> 
> If http_host is ''subdomain.sponsor.url" we are at the site using the
> sponsor's alias which maps to a unique "/year/slug/" on our site (just one
> of many). In this case, we require the output of {% url %} and reverse() to
> have 2 possibilities:
> 
>1. Normal operation (with our default http_host): returns the full path:
>"/year/slug/some/more/path/"
>2. Sponsor http_host: returns a trimmed path: "/some/more/path". Here
>"/year/slug" is suppressed as it is built into the
> ''subdomain.sponsor.url" alias.
> 
> I hope this clarifies what we think we need to do

Aha! Now I get it! This should be solveable at the WSGI layer:

PATH_INFO
The remainder of the request URL's "path", designating the virtual "location" 
of the 
request's target within the application. This *may* be an empty string, if the 
request URL 
targets the application root and does not have a trailing slash.

See https://www.python.org/dev/peps/pep-0333/

A URL rewrite or proxy at the webserver level should work as well. It may take 
a bit of 
experimenting.

-- 
Melvyn Sopacua

-- 
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/8690183.REoEi0XuKK%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


Re: Sponsor subdomain pointing to part of our Django site?

2018-06-04 Thread Richard Brockie
On Mon, Jun 4, 2018 at 9:01 PM Melvyn Sopacua  wrote:

> This isn't a problem. Neither url nor reverse is capable of returning URLs
> with hostnames, at least not that I'm aware of. Only django.contrib.site
> 
> module can do this for out-of-band communications.
>

Aha - there's an error in how I posed the question. I was confusing the url
and reverse() outputs with the links as interpreted by a browser.

If http_host is ''subdomain.sponsor.url" we are at the site using the
sponsor's alias which maps to a unique "/year/slug/" on our site (just one
of many). In this case, we require the output of {% url %} and reverse() to
have 2 possibilities:

   1. Normal operation (with our default http_host): returns the full path:
   "/year/slug/some/more/path/"
   2. Sponsor http_host: returns a trimmed path: "/some/more/path". Here
   "/year/slug" is suppressed as it is built into the ''subdomain.sponsor.url"
   alias.

I hope this clarifies what we think we need to do?


> So if you're encountering such cases, then you're using custom or 3rd
> party code or have a hardcoded hostname in your templates or are using the
> site module.
>
>
>
> There is no magic case where reverse or the url template tag decides to
> add a hostname, because it senses you want it. And if you just want to
> serve the exact same site on a different domain, then ALLOWED_HOSTS is all
> you need.
>

We're wanting to do something else - the sponsor's subdomain points to just
one part of our site. We want to keep the charade of this part of our site
being part of the sponsor subdomain so the urls that we present to browsers
have to adjust correctly.

You rightly deduce that we are going to brand this part of the site
differently, but this will be global and will not depend on the http_host.

Thanks!
R.



>
> If you want to brand the site with a different look and feel, then you
> will need the site module, because then you will serve different content.
>
>
>
> If you're asking "how can i be sure there are no mistakes in our code",
> then you should already know the answer - test, test, test :).
>
> --
>
> Melvyn Sopacua
>
> --
> 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/jZt_bO2dR5c/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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1789736.NRtqCP1Ze9%40fritzbook
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
R.

Richard Brockie

Real-time bicycle race results - www.ontheday.net

-- 
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/CAKv-vOV3iMDgzrNkKM_J%3DYispGnVV26tYQkDZ9xegtp_icvNhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: calculate the followers difference/grow by day

2018-06-04 Thread Daniel Germano Travieso
Hello!
I don't quite understand what you mean by the followers difference by day,
but as that difference by day is not a property of each model tuple, but a
property of a specific day, you can write a view to handle that processing.
Custom model Managers are used to either add manager methods or to
customize and change the QuerySet your model returns. If you wish to use
the model manager for this, it could be used to add a field to your model
that makes a query to the last followers on that day and calculates the
difference (?). You could also use a @property on your Model class for that
too.

Hope it helps!

*[]'s*
*Daniel Germano Travieso*
*Engenharia da Computação Turma: 013*
*Unicamp*

On Thu, May 31, 2018 at 11:14 AM, João Paulo 
wrote:

>
> Hey guys,
>
> I´m using SQLite and trying to calculate the followers difference by day
>
> This is my model:
>
> class Statistics(models.Model):
> followers = models.IntegerField()
> last_update = models.DateTimeField(auto_now_add=True)
>
> This are my database rows:
>
> "6" "50" "*2018-05-29* 00:25:48.276102"
> "1" "100" "*2018-05-29* 00:26:48.276102"
> "3" "200" "*2018-05-30* 00:27:04.178444"
> "5" "250" "*2018-05-30* 00:30:04.178444"
> "4" "300" "*2018-05-31* 00:27:04.178444"
>
> And the result I´m tryting to achieve is:
>
> followers | last_update
> 150
> *2018-05-30*50
>
> *2018-05-31*
> *# I´m new to Django and thinking about use a Manager, but don't know if´s
> doable using a Manager# Does anyone has a suggestion ?*
>
> --
> 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/3196a628-a53f-41ac-bcbf-6cc8b8a66016%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/CABF8kZNYHY8zWYNw3WKTxLMcnsxxDU9hPAep4wpzk9i4c-veRg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: installation help please

2018-06-04 Thread Daniel Germano Travieso
If you are using Windows, I highly recommend you to use a tool such as
Conda or VirtualEnv. It greatly increases the level of encapsulation of
your different django projects you may create, as each one may use
different python or django modules.

Check Conda out at https://anaconda.org/anaconda/conda

Hope it helps.

*[]'s*
*Daniel Germano Travieso*
*Engenharia da Computação Turma: 013*
*Unicamp*

On Thu, May 31, 2018 at 8:24 AM, Rafael E. Ferrero  wrote:

> please use some kind of virtual environment... in linux its virtualenvs
>
>
> Rafael E. Ferrero
>
> 2018-05-31 8:06 GMT-03:00 kailash jangu :
>
>> guys i installed django version 2.0.5 in windows but when i use
>> django-admin command it shows me error what path i should i go with to get
>> start with my newproject and do database api driver has role in it. i have
>> my django-admin executive and python file in pyhton36/scripts what do i do
>> help please...
>>
>> --
>> 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/ms
>> gid/django-users/139a9b30-7301-4ac9-a0af-816621fda116%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/CAJJc_8XS%2BdX_sTQUXQcLPrDSFaszLzhoAqayWHZF0A
> x2bp4ptQ%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABF8kZP7ZsSqb67ZK0iFJiXoNUe4%3DGV1zdpdJb5v7bCe5E7xAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multisite strategy

2018-06-04 Thread Daniel Germano Travieso
Hello Carlo,

I don't see what you mean by change the current site at runtime?

If you mean change the site the user is accessing, just forward the user
via the URL to the proper site you mean to reach.

Hope it helps!

*[]'s*
*Daniel Germano Travieso*
*Engenharia da Computação Turma: 013*
*Unicamp*

On Thu, May 31, 2018 at 5:14 AM, Carlo Ascani  wrote:

> Il giorno mer 23 mag 2018 alle ore 17:02 Daniel Germano Travieso
>  ha scritto:
> >
> > Hello!
> > The Sites Framework is exactly what you need (and the proper
> internationalization/localization for the languages).
> > Just set up your 3 sites the Django way (creating the propper
> settings.py for each site)
> > Then you can run each site using `manage.py runserver  --settings
> .py`
> >
> > You can access each different site in development by going to
> localhost:
> >
> > As a suggestion, to avoid overhead in the creation of a site that is
> only responsible for the choice of the site and language, I would assing
> one of the two sites to be the default one, but the first action the user
> takes when accessing the site is to choose location and language, but it is
> a personal thing and your way can and will work fine!
> >
> > Hope it helps!
>
>
> Thank you!
>
> Is it possible to change the current site at runtime?
>
>
> >
> > []'s
> > Daniel Germano Travieso
> > Engenharia da Computação Turma: 013
> > Unicamp
> >
> > On Tue, May 22, 2018 at 3:31 AM, Carlo Ascani 
> wrote:
> >>
> >> Hi all,
> >>
> >> I'd like to implement something like this:
> >>
> >> One Django project to serve 3 sites:
> >> 1. `domain.com` which is the "master" site, containing just a landing
> page
> >> 2. `de.domain.com` which is the "German" site
> >> 3. `en.domain.com` which is the "UK" site
> >>
> >> `de` and `en` refers the location, not the language (e.g. `
> de.domain.com/en/` is the German site in English)
> >>
> >> If you go to `domain.com` you can choose the language and the country,
> and you are just redirected to the right place.
> >>
> >> Is `contrib.site` suitable for that scenario?
> >> I was thinking at 3 different sites.
> >> If so, how can I use them locally while in development?
> >>
> >> Any other suggestions?
> >>
> >> Best,
> >> Carlo
> >>
> >>
> >> --
> >> 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/3b068855-78e7-4742-890d-1fc8a545b4f4%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/CABF8kZM%2BD-4Cou6s0bHJC15MeXLjeEaVrLBLdDTH
> d5%3DG1%3DupPA%40mail.gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Carlo Ascani aka carloratm
>
> http://carlo.ratm.gitlab.io
> carloratm@freenode
>
> --
> 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/CABVJJr8ONoKEWyYa-_43JMb%3DhnzRa_d6JzNfK29G58SkiwJQAw%
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABF8kZOkeN_JbOtWiRYTK%3DpiP%3D_hzvAj9bdDaW2-V5NoF-_Eyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error running WSGI application

2018-06-04 Thread Joseph Mutumi
Hello,

Check
https://help.pythonanywhere.com/pages/DebuggingImportError/#django-specific-issues

And make sure your directory structure is as recommended:

/home/myusername
`-- myproject/
|-- __init__.py
`-- myproject/
|-- __init__.py
`-- settings.py

If it is not, then correct the sys.path.append(path) in your wsgi file to
where ever it is e.g.: sys.path.append(os.path.dirname(path))

Hope it helps.

Kind regards

On Sat, May 26, 2018 at 9:02 PM, Kadir Guloglu 
wrote:

> Hi friends.
>
>
>  Can I help we please. My project getting exception.
>
>
> WSGI File:
>
> import os
>
> import sys
>
>
> path = os.path.expanduser('~/otomabak')
>
> if path not in sys.path:
>
> sys.path.append(path)
>
>
> os.environ['DJANGO_SETTINGS_MODULE'] = 'otomabak.settings'
>
>
> from django.core.wsgi import get_wsgi_application
>
> from django.contrib.staticfiles.handlers import StaticFilesHandler
>
> application = StaticFilesHandler(get_wsgi_application())
>
>
>
> Server Error :
>
> 2018-05-26 17:43:02,582: Error running WSGI application
> 2018-05-26 17:43:02,583: ModuleNotFoundError: No module named 
> 'otomabak.settings'
> 2018-05-26 17:43:02,583:   File 
> "/var/www/kadirguloglu_pythonanywhere_com_wsgi.py", line 12, in 
> 2018-05-26 17:43:02,583: application = 
> StaticFilesHandler(get_wsgi_application())
> 2018-05-26 17:43:02,583:
> 2018-05-26 17:43:02,583:   File 
> "/home/kadirguloglu/otomabak/otomabakenv/lib/python3.6/site-packages/django/core/wsgi.py",
>  line 12, in get_wsgi_application
> 2018-05-26 17:43:02,583: django.setup(set_prefix=False)
> 2018-05-26 17:43:02,584:
> 2018-05-26 17:43:02,584:   File 
> "/home/kadirguloglu/otomabak/otomabakenv/lib/python3.6/site-packages/django/__init__.py",
>  line 19, in setup
> 2018-05-26 17:43:02,584: configure_logging(settings.LOGGING_CONFIG, 
> settings.LOGGING)
> 2018-05-26 17:43:02,584:
> 2018-05-26 17:43:02,584:   File 
> "/home/kadirguloglu/otomabak/otomabakenv/lib/python3.6/site-packages/django/conf/__init__.py",
>  line 56, in __getattr__
> 2018-05-26 17:43:02,584: self._setup(name)
> 2018-05-26 17:43:02,584:
> 2018-05-26 17:43:02,584:   File 
> "/home/kadirguloglu/otomabak/otomabakenv/lib/python3.6/site-packages/django/conf/__init__.py",
>  line 43, in _setup
> 2018-05-26 17:43:02,584: self._wrapped = Settings(settings_module)
> 2018-05-26 17:43:02,585:
> 2018-05-26 17:43:02,585:   File 
> "/home/kadirguloglu/otomabak/otomabakenv/lib/python3.6/site-packages/django/conf/__init__.py",
>  line 106, in __init__
> 2018-05-26 17:43:02,585: mod = 
> importlib.import_module(self.SETTINGS_MODULE)
> 2018-05-26 17:43:02,585: ***
> 2018-05-26 17:43:02,585: If you're seeing an import error and don't know why,
> 2018-05-26 17:43:02,585: we have a dedicated help page to help you debug:
> 2018-05-26 17:43:02,585: 
> https://help.pythonanywhere.com/pages/DebuggingImportError/
> 2018-05-26 
>  
> 17:43:02,585: ***
>
>
>
> *Thanks for help*
>
> --
> 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/560746fa-8d6f-4a45-ae44-43ee8bf53eb6%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/CAN5idp_ZFKzvLtEpxBJpHPgx_TbE8ihKp5zDK7YSwi7e4GmAXw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Flask-supermarket forms creation

2018-06-04 Thread Joseph Mutumi
Hello,

Check Django formset documentation:
https://docs.djangoproject.com/en/2.0/topics/forms/formsets/

For Flask, if you are using WTForms check the using the combination
of FieldList with FormField:
http://wtforms.simplecodes.com/docs/0.6/fields.html#field-enclosures

Though this is a Django discussion forum!

Kind regards

On Tue, May 29, 2018 at 10:47 AM, subhani shaik 
wrote:

> Hi..
> group members.
>
> i am creating supermarket forms using flask and python with the help of
> jquery and ajax.but the problem is how can i design multiple forms.please
> give me suggestions.or else please give me the multiple forms.
>
>
> my form is like this
>
>
> Redumptionid
> userid
> receiptno
>
>
> like this multiple forms..
>
>
>
>
>
> please help me.
>
> --
> 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/2b7acdec-9ff7-4513-acdb-dcc04436501d%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/CAN5idp_PptkfAa1whbQWo6oNAF2UQ5KZbSuL62W98YWnTiP4WQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: one-to-one GenericRelation best practices

2018-06-04 Thread Joseph Mutumi
Hello,

May be you want to subclass GenericForeignKey:

class GenericOneToOne(GenericForeignKey):
many_to_one = False
one_to_many = False
one_to_one = True

Though have not tried it so YMMV.

Kind regards

On Thu, May 31, 2018 at 8:59 PM, Vitor Barbosa  wrote:

> Hello! This is my first question, so please excuse any mistakes.
>
> I'm using django 1.8 (working on migration to 2.0).
>
> I need to implement a one-to-one generic relation. To illustrate suppose I
> have three classes, the first representing and abstract class in a store
> and the other specific products which need extra information:
>
>
> AbstractProduct(models.Model):
> 
> sale = GenericRelation('Sales')
> class Meta:
> abstract = True
>
> Books(AbstractProduct):
> 
>
> Magazines(AbstractProduct):
> 
>
>
> Now I need to create a models for 'Sales'. Each sale is of a specific
> product. Following https://docs.djangoproject.com/en/2.0/ref/contrib/
> contenttypes/#generic-relations I used:
>
> class Sales(models.Model):
> 
> content_type = models.ForeignKey(...)
> object_id = models.PositiveIntegerField(...)
> content_object = GenericForeignKey('content_type', 'object_id')
>
>
> My problem is that by using this approach whenever I do
>
> >>> Books.objects.get(pk=1).sale
>
> I get back a manager since django does not know it is a one-to-one
> relation. And it makes me think that maybe I'm approaching this in the
> wrong way.
>
> My question is:
> (a) is this design a good solution for this problem? Is there a better
> approach? Has anyone solved a similar problem in a better way?
> (b) is there a way to create a generic One-To-One relation?
>
> I'm open to answers pointing to good blogs/books/articles which give a
> more formal approach to this kind of design issue, if you know a good one.
>
> Thanks in advance! Yours,
>
> Vitor.
>
>
> --
> Vitor Quintanilha Barbosa
>
> --
> 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/ms
> gid/django-users/CAB-MUC7h4S32XE8nj7%2BtpeYdv%3DtH%3DQBX3ghx
> 0rVxU%2BF0mTAakg%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN5idp-rArqkLYuZz3juofd4OzK4qCq8ehnzPB4Ws9zOQpj1Jw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Creating Reports in Django Admin Panel

2018-06-04 Thread Joseph Mutumi
Hello,

You'll first need to create a custom admin page. Create your view and add
it to the urls.py like normal.

Then you extend the admin base template and display your aggregation in
there:

{% extends "admin/base_site.html" %} {% block title %}Stats title{%
endblock %} {% block content %}Stats HTML{% endblock %}

The you aggregate what you need in the view function and pass that. You'll
need to have the relevant
data counters before hand though. You might want to checkout signals to
implement that?
https://docs.djangoproject.com/en/2.0/topics/signals/

Kind regards

On Sat, Jun 2, 2018 at 6:23 AM, Mukul Mantosh 
wrote:

> How to create a report in  django-admin panel of number of users added to
> the database in a day, week and month. Also, how many API calls for every
> particular API has been made in a day, week and month.
>
> --
> 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/ms
> gid/django-users/cde57aba-e168-4c74-97b9-7e4b3a48458c%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/CAN5idp9953zu9rF939qTiVxpOMFZGfe6OYxOFZKagOTG%2BMct8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: python manage.py (anything) NOT WORKING ANYMORE

2018-06-04 Thread Melvyn Sopacua
On maandag 4 juni 2018 12:58:39 CEST Gerald Brown wrote:
> I have been using ./manage.py shell for awhile and now all of a sudden it
> has stopped working with the error "AttributeError: 'property' object has
> no attribute '__dict__'".  I get the same error with anything I enter after
> the ./manage.py (i.e. runserver, dbshell, etc)

You most likely switched to Python 3. But a backtrace would help a lot to 
understand the cause.

-- 
Melvyn Sopacua

-- 
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/3093672.KM6zN6OXxa%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


Re: Sponsor subdomain pointing to part of our Django site?

2018-06-04 Thread Melvyn Sopacua
On maandag 4 juni 2018 13:26:24 CEST Richard Brockie wrote:

> However, I'm pretty sure that we will need to make some changes to our
> project to deal with links when the site is being accessed through
> "subdomain.sponsor.url/". You are correct that {% url %} is used in the
> templates as well as django.core.urlresolvers.reverse() being used in the
> code. However, I think we need to catch the case where url or reverse() are
> returning "site.url/year/slug/some/more/path/" and convert it to
> "subdomain.sponsor.url/some/more/path/" based on the http_host in the
> request.
> 
> I'm wondering if this is a solved problem?

This isn't a problem. Neither url nor reverse is capable of returning URLs with 
hostnames, 
at least not that I'm aware of. Only django.contrib.site[1] module can do this 
for out-of-
band communications.

So if you're encountering such cases, then you're using custom or 3rd party 
code or have a 
hardcoded hostname in your templates or are using the site module.

There is no magic case where reverse or the url template tag decides to add a 
hostname, 
because it senses you want it. And if you just want to serve the exact same 
site on a 
different domain, then ALLOWED_HOSTS is all you need.

If you want to brand the site with a different look and feel, then you will 
need the site 
module, because then you will serve different content.

If you're asking "how can i be sure there are no mistakes in our code", then 
you should 
already know the answer - test, test, test :).
-- 
Melvyn Sopacua


[1] 
https://docs.djangoproject.com/en/2.0/ref/contrib/sites/#getting-the-current-domain-for-display

-- 
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/1789736.NRtqCP1Ze9%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


Re: python manage.py (anything) NOT WORKING ANYMORE

2018-06-04 Thread Andréas Kühne
Hi,

I got really strange issues when I upgraded my ubuntu machine from 17.04 to
17.10 when they changed the python version that was shipped with ubuntu
(only going from python3.5 to 3.6 I THINK). This made all of my python
environments stop working and I had to recreate them from scratch. Have you
tried reinitializing the virtual environment?

Regards,

Andréas

2018-06-04 13:01 GMT+02:00 Gerald Brown :

>
>
> On Monday, June 4, 2018 at 6:58:39 PM UTC+8, Gerald Brown wrote:
>>
>> I have been using ./manage.py shell for awhile and now all of a sudden it
>> has stopped working with the error "AttributeError: 'property' object has
>> no attribute '__dict__'".  I get the same error with anything I enter after
>> the ./manage.py (i.e. runserver, dbshell, etc)
>>
>> I think it might have to do with something I added to my requirements.txt
>> file.
>>
>> Does anyone know of a way other than committing out the requirements.txt
>> one-by-one on how to solve this problem?
>>
>
> By the way it is running in a pyvenvwrapper virtual environment .
>
>>
>> Thanks.
>>
> --
> 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/b0b8631b-990b-4123-bc14-e10cf9b1406a%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/CAK4qSCeZ7j4-kgFZUCHdBT1zyRKO3RxsCYqj90cg3HDM6eUJ0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: python manage.py (anything) NOT WORKING ANYMORE

2018-06-04 Thread 'Anthony Flury' via Django users

On 04/06/18 12:01, Gerald Brown wrote:



On Monday, June 4, 2018 at 6:58:39 PM UTC+8, Gerald Brown wrote:

I have been using ./manage.py shell for awhile and now all of a
sudden it has stopped working with the error "AttributeError:
'property' object has no attribute '__dict__'".  I get the same
error with anything I enter after the ./manage.py (i.e. runserver,
dbshell, etc)

I think it might have to do with something I added to my
requirements.txt file.

Does anyone know of a way other than committing out the
requirements.txt one-by-one on how to solve this problem?


By the way it is running in a pyvenvwrapper virtual environment .


if everything is running in your virtual enviornment, do a `pip freeze` 
in both environments - and then do a diff between them - that at least 
will tell you which packages you have in the non-working environment 
which might be different from the working environment; there might be a 
lot though.


Have you possibly upgraded your django installation in the non-working 
environment - I can't image any 3rd Party non django installations 
breaking the Django such that the manage.py now doesn't work.


the other possibility is that your default python is different between 
the two environment.



Thanks.

--
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/b0b8631b-990b-4123-bc14-e10cf9b1406a%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury *

--
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/1c00d406-ddc7-b4ff-dfe3-efbab446a07e%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sponsor subdomain pointing to part of our Django site?

2018-06-04 Thread Richard Brockie
Hi Melvyn,

Thanks for the reply. We will test this after getting the ssl certificates
sorted out.

However, I'm pretty sure that we will need to make some changes to our
project to deal with links when the site is being accessed through
"subdomain.sponsor.url/". You are correct that {% url %} is used in the
templates as well as django.core.urlresolvers.reverse() being used in the
code. However, I think we need to catch the case where url or reverse() are
returning "site.url/year/slug/some/more/path/" and convert it to
"subdomain.sponsor.url/some/more/path/" based on the http_host in the
request.

I'm wondering if this is a solved problem?

Thanks,
R.



On Mon, Jun 4, 2018 at 6:02 AM Melvyn Sopacua  wrote:

> On zondag 3 juni 2018 22:45:31 CEST Richard Brockie wrote:
>
> > Any advice on how I can accomplish this? Any particular things I would
> need
> > to do in the Django project to make this possible?
>
> Since you seem to be using the {% url %} tag and have no absolute URLs
> with
> the hostname in it, I don't think Django is part of the problem, short of
> ALLOWED_HOSTS setting.
>
> Your problem would be in the webserver configuration and as you suspected
> the
> SSL certificate.
>
> Why don't you add a subdomain 'test', add it to allowed hosts setting, add
> the
> certificate and see what breaks. I don't think anything breaks at all.
> --
> Melvyn Sopacua
>
> --
> 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/jZt_bO2dR5c/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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/33245904.Kc6r1lpH81%40fritzbook
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
R.

Richard Brockie

Real-time bicycle race results - www.ontheday.net

-- 
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/CAKv-vOXt%3Dqv93UEEkc1x%2BeP8HDJgAqjnNgXBNzw1KC_W3Rp9Fg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: python manage.py (anything) NOT WORKING ANYMORE

2018-06-04 Thread Gerald Brown


On Monday, June 4, 2018 at 6:58:39 PM UTC+8, Gerald Brown wrote:
>
> I have been using ./manage.py shell for awhile and now all of a sudden it 
> has stopped working with the error "AttributeError: 'property' object has 
> no attribute '__dict__'".  I get the same error with anything I enter after 
> the ./manage.py (i.e. runserver, dbshell, etc)
>
> I think it might have to do with something I added to my requirements.txt 
> file.
>
> Does anyone know of a way other than committing out the requirements.txt 
> one-by-one on how to solve this problem?
>

By the way it is running in a pyvenvwrapper virtual environment .

>
> Thanks.
>

-- 
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/b0b8631b-990b-4123-bc14-e10cf9b1406a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


python manage.py (anything) NOT WORKING ANYMORE

2018-06-04 Thread Gerald Brown
I have been using ./manage.py shell for awhile and now all of a sudden it 
has stopped working with the error "AttributeError: 'property' object has 
no attribute '__dict__'".  I get the same error with anything I enter after 
the ./manage.py (i.e. runserver, dbshell, etc)

I think it might have to do with something I added to my requirements.txt 
file.

Does anyone know of a way other than committing out the requirements.txt 
one-by-one on how to solve this problem?

Thanks.

-- 
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/dc220707-4c2a-46bd-a7d4-622cec1aec83%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Generating server-side off-line HTML of Django pages ...

2018-06-04 Thread Melvyn Sopacua
On maandag 4 juni 2018 08:00:08 CEST Bernd Wechner wrote:
> Say I have a page on my Django website (because I do) that I would like to
> take a snapshot of on an automated basis on the server itself with a
> crontab say. I imagine writing a small python script that I could run, that
> loads Django, a settings file, knows a URL and has a way of saying "give me
> the rendered page for that URL please" and save it in a file.

...

> a) there's a canonical way to do this already that can be recommended

Yep. The test client [1]... if your template uses request related information 
(like logged in 
user). The cheaper method is something like this code[2], but this only renders 
the 
template and you'd have to provide a context so view code is bypassed.

-- 
Melvyn Sopacua


[1] https://docs.djangoproject.com/en/2.0/topics/testing/tools/#the-test-client
[2] https://github.com/melvyn-sopacua/django_xtc/blob/master/xtc/__init__.py#L49

-- 
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/3641770.R8fxcq3Jsz%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


Re: Django bugfix release: 2.0.6

2018-06-04 Thread Umar Kambala
Thanks for the help,
After making that corrections, I have another error which is

'APP_DIRS': True,
SyntaxError: invalid syntax
Need more help
On Jun 3, 2018 11:37 AM, "刘家伟"  wrote:

> Django need template dir to store your html ,so in the setting.py , you
> shuold set the template dir like this:
>
> TEMPLATES = [
> {
> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
> 'DIRS': [os.path.join(BASE_DIR, 'template')]
> ,
> 'APP_DIRS': True,
> 'OPTIONS': {
> 'context_processors': [
> 'django.template.context_processors.debug',
> 'django.template.context_processors.request',
> 'django.contrib.auth.context_processors.auth',
> 'django.contrib.messages.context_processors.messages',
> ],
> },
> },
> ]
>
> and  it is in root path of your project
>
> 2018-06-03 18:20 GMT+08:00 Umar Kambala :
>
>> Please I have a problem, after successfully going through the django
>> polls and having results, and now wans to run a tuturial on a web
>> development, wen I  runserver I gets errors. I don't really understand
>> where the problem is. The problem is "NameError:name 'template' is not
>> defined"
>> On Jun 1, 2018 4:22 PM, "Carlton Gibson" 
>> wrote:
>>
>>> Details are available on the Django project weblog:
>>> https://www.djangoproject.com/weblog/2018/jun/01/bugfix-release/
>>>
>>> --
>>> 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/ms
>>> gid/django-users/7d59d8c3-cc5b-4ecc-ac23-ce1fcb64d5ac%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/ms
>> gid/django-users/CAPkbFbZ20jqjLVTZgJmg7busKczCpZUj3xDjkYeR3h
>> aeWj%3DcYA%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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAH_QYw5%2Brq_Mc%2BLjT4KW8ZS4Q9HK%
> 2B38JwqBkxRdapK6sNte6kw%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPkbFbZUm5GhOJ8%3DGHi0zCsZuCfc%2BT9s1-GqPGpiaSdedptV3Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Generating server-side off-line HTML of Django pages ...

2018-06-04 Thread Bernd Wechner
Say I have a page on my Django website (because I do) that I would like to 
take a snapshot of on an automated basis on the server itself with a 
crontab say. I imagine writing a small python script that I could run, that 
loads Django, a settings file, knows a URL and has a way of saying "give me 
the rendered page for that URL please" and save it in a file. 

On way of course is open port 80 or 443, send an HTTP request and get the 
HTTP response. But there is probably a better way that leaves the web and 
UWSGI servers right out of the equation and just runs Django template 
rendering code or a view itself and nabs the result.

As usual, I'm both confident this is possible and that I'll nut out a way 
to do it, but am throwing it out there in case:

a) there's a canonical way to do this already that can be recommended
b) I can save myself some time reading and experimenting if anyone whose 
done this already shares their experience

I will raise the bar one on the original question while I'm here, and raise 
the spectre of autorun on page load javascript that the page may have. 
Makes it hairier by a step. But it's not unusual for javascript to do some 
rendering on page load - I have a page or two like that ;-), In that case 
neither of these strategies are likely to work and either one might if 
coupled with what would basically need to be, a rendering engine like 
mozilla's. Does Python offer that I wonder, a way to pump a response (with 
embedded Javascript) into a rendering engine and then save (or request) the 
rendered page?

Kind regards,

Bernd.

-- 
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/6353b82e-7f0d-465f-9eba-68ed207940a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.