Noob question: Is the User model compatible with subscription-style website?

2018-02-14 Thread Tom Tanner
I'm working on a Django-powered subscription website with a Django-powered 
CMS backend. Can the User model, or a derived class, be made to be 
compatible with this idea? In my case, I want to store a user's username, 
password, and subscription ID. 

-- 
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/da4f96f9-95cd-4b23-b4d2-842ef3649226%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Syntax Error when trying to migrate to Postgresql

2018-02-14 Thread Joe
The problem was with the quotes being weird format, had to copy and paste 
the correct quotes in for it.  Thanks for the help!!

On Wednesday, February 14, 2018 at 9:59:06 PM UTC-5, Joe wrote:
>
> I used TextEdit on Mac to edit the files, maybe using a different editor 
> would work better.
>
> On Wednesday, February 14, 2018 at 5:41:24 PM UTC-5, larry@gmail.com 
> wrote:
>>
>> On Wed, Feb 14, 2018 at 5:32 PM, Joe  wrote: 
>> > 
>> > DATABASES = { 
>> > 'default': { 
>> > 'ENGINE': 'django.db.backends.postgresql', 
>> > 'NAME': ‘postgres’, 
>> > 'USER': ‘postgres’, 
>> > 'PASSWORD': ‘*’, 
>> > 'HOST': ‘localhost’, 
>> > 'PORT': ‘8000’, 
>> > } 
>> > } 
>>
>> Looks like the quotes around the values are some non ascii character. 
>> On my screen I see this: 
>>
>> ‘ 
>>
>> Change it to ' or " 
>>
>> Did you copy/paste that from Word perhaps? 
>>
>

-- 
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/872de896-e541-466b-a158-5bcc59e7914b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Syntax Error when trying to migrate to Postgresql

2018-02-14 Thread Joe
I used TextEdit on Mac to edit the files, maybe using a different editor 
would work better.

On Wednesday, February 14, 2018 at 5:41:24 PM UTC-5, larry@gmail.com 
wrote:
>
> On Wed, Feb 14, 2018 at 5:32 PM, Joe  
> wrote: 
> > 
> > DATABASES = { 
> > 'default': { 
> > 'ENGINE': 'django.db.backends.postgresql', 
> > 'NAME': ‘postgres’, 
> > 'USER': ‘postgres’, 
> > 'PASSWORD': ‘*’, 
> > 'HOST': ‘localhost’, 
> > 'PORT': ‘8000’, 
> > } 
> > } 
>
> Looks like the quotes around the values are some non ascii character. 
> On my screen I see this: 
>
> ‘ 
>
> Change it to ' or " 
>
> Did you copy/paste that from Word perhaps? 
>

-- 
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/92f1bbad-512c-439d-bc4a-d5ae68d41d32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Syntax Error when trying to migrate to Postgresql

2018-02-14 Thread Larry Martell
On Wed, Feb 14, 2018 at 5:32 PM, Joe  wrote:
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.postgresql',
> 'NAME': ‘postgres’,
> 'USER': ‘postgres’,
> 'PASSWORD': ‘*’,
> 'HOST': ‘localhost’,
> 'PORT': ‘8000’,
> }
> }

Looks like the quotes around the values are some non ascii character.
On my screen I see this:

‘

Change it to ' or "

Did you copy/paste that from Word perhaps?

-- 
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/CACwCsY4Dsr54goCOTKfDJLm%2B5mfX5ZEVDvBv9_Xq%2BEyhAafNTQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError: 'module' object has no attribute 'lru_cache' with python 3.6.4 and Django 2.0.2

2018-02-14 Thread PASCUAL Eric
Maybe it works like this in Windows (I don't know since having left this world 
since long now), but Greng mentioned a Debian environment inside his Docker 
container. Hence my remark.


By the way you mentioned "DLLs". Geng's trouble seems to be related to Python 
packages finding, not binary libs. In Linux, they are governed by different 
search paths.


Eric


From: django-users@googlegroups.com  on behalf 
of Matthew Pava 
Sent: Wednesday, February 14, 2018 4:05:57 PM
To: 'django-users@googlegroups.com'
Subject: RE: AttributeError: 'module' object has no attribute 'lru_cache' with 
python 3.6.4 and Django 2.0.2


I’m not familiar with Docker, but I did have to add the path to Python 3.6 DLLs 
in my WSGI configuration in my Apache configuration file.

WSGIPythonPath ${project_path};${virtualenv};C:/Python36/DLLs;



From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of PASCUAL Eric
Sent: Wednesday, February 14, 2018 8:52 AM
To: Django users
Subject: Re: AttributeError: 'module' object has no attribute 'lru_cache' with 
python 3.6.4 and Django 2.0.2



Hi,



Normally you shouldn't have to add site-packages in the PYTHONPATH since it is 
supposed to be already. If not, packages installed via "sudo pip install" would 
not be found.



I've packaged a lot of applications in Docker containers, and never had to 
modify PYTHONPATH.



Your problem is maybe be lurking elsewhere than PYTHONPATH, and this change has 
just created a new one which is hiding the original one, but not solving it at 
all.



Best



Eric



From: django-users@googlegroups.com 
> on behalf 
of Greng Fortezza >
Sent: Wednesday, February 14, 2018 3:02:28 PM
To: Django users
Subject: AttributeError: 'module' object has no attribute 'lru_cache' with 
python 3.6.4 and Django 2.0.2



Hi,



I'm trying to set up the following configuration in Docker

python: 3.6.4

Django: 2.0.2

Apache/2.4.10 (Debian)



First, I was getting the error



ImportError: No module named django.core.wsgi



Then I added Django to PYTHONPATH



export PYTHONPATH="/usr/local/lib/python3.6/site-packages"



the previous problem has gone away but now there is another one



AttributeError: 'module' object has no attribute 'lru_cache'

Apache configs contains the following line



WSGIScriptAlias / /www/settings/wsgi.py

where /www/settings/wsgi.py is  actual path to wsgi.py file.



What could be wrong?



Thanks,

Greng

--
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/02803efb-92a9-4958-9a52-f77bee7de89b%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/AM5P193MB008328E4760DBF0DA724D2238CF50%40AM5P193MB0083.EURP193.PROD.OUTLOOK.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 

Re: Syntax Error when trying to migrate to Postgresql

2018-02-14 Thread Joe

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': ‘postgres’,
'USER': ‘postgres’,
'PASSWORD': ‘*’,
'HOST': ‘localhost’,
'PORT': ‘8000’,
}
}

On Wednesday, February 14, 2018 at 3:58:59 AM UTC-5, Andy wrote:
>
> Could you post a few more lines of this settings.py? Preferably the whole 
> DATABASES definition.
>
> Just in case there actually is a weird invisible character try retyping 
> 'postgresql', but more likely it looks as if you are using wrong quotation 
> marks other than ' or ". I dont even have on my keyboard whats in your 
> error message.
>
>
> Am Mittwoch, 14. Februar 2018 01:17:43 UTC+1 schrieb Joe:
>>
>> I have installed django, Postgresql, and psycopg2 and went to migrate a 
>> project to a new database I created on postgresql, This is the error 
>> message I got. 
>>
>> Traceback (most recent call last):
>>
>>   File "manage.py", line 15, in 
>>
>> execute_from_command_line(sys.argv)
>>
>>   File 
>> "/Users/JosephConrad/Desktop/Joetestsite/lib/python3.6/site-packages/django/core/management/__init__.py",
>>  
>> line 371, in execute_from_command_line
>>
>> utility.execute()
>>
>>   File 
>> "/Users/JosephConrad/Desktop/Joetestsite/lib/python3.6/site-packages/django/core/management/__init__.py",
>>  
>> line 317, in execute
>>
>> settings.INSTALLED_APPS
>>
>>   File 
>> "/Users/JosephConrad/Desktop/Joetestsite/lib/python3.6/site-packages/django/conf/__init__.py",
>>  
>> line 56, in __getattr__
>>
>> self._setup(name)
>>
>>   File 
>> "/Users/JosephConrad/Desktop/Joetestsite/lib/python3.6/site-packages/django/conf/__init__.py",
>>  
>> line 43, in _setup
>>
>> self._wrapped = Settings(settings_module)
>>
>>   File 
>> "/Users/JosephConrad/Desktop/Joetestsite/lib/python3.6/site-packages/django/conf/__init__.py",
>>  
>> line 106, in __init__
>>
>> mod = importlib.import_module(self.SETTINGS_MODULE)
>>
>>   File 
>> "/Users/JosephConrad/Desktop/Joetestsite/lib/python3.6/importlib/__init__.py",
>>  
>> line 126, in import_module
>>
>> return _bootstrap._gcd_import(name[level:], package, level)
>>
>>   File "", line 978, in _gcd_import
>>
>>   File "", line 961, in _find_and_load
>>
>>   File "", line 950, in 
>> _find_and_load_unlocked
>>
>>   File "", line 655, in _load_unlocked
>>
>>   File "", line 674, in exec_module
>>
>>   File "", line 781, in get_code
>>
>>   File "", line 741, in 
>> source_to_code
>>
>>   File "", line 205, in 
>> _call_with_frames_removed
>>
>>   File 
>> "/Users/JosephConrad/Desktop/Joetestsite/MySite/BudgetSite/settings.py", 
>> line 77
>>
>> ‘postgresql’: {
>>
>>^
>>
>> SyntaxError: invalid character in identifier
>>
>>
>>
>> I am able to migrate with sqllite but I can't migrate to postgresql.
>>
>

-- 
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/05c0666e-af6c-483e-9aca-a5730e210506%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Basic note/trello app - how to link model object IDs

2018-02-14 Thread Lylio
Thanks for the reply Melvyn - I'm slowly getting there!

So, I now understand how to insert the unique object reference. After 
creating card.html, and defining card in views, my list element URL is:

{% for card in cards.all %}
{{ card.title 
}} 
{% endfor %}

And if I click on the second card object in the list, it opens 
up http://127.0.0.1:8000/scrumbuddy/card/2 - hooray, progress!

Ok, so now I understand what *card.id* is and I use this to references the 
model object instances. So, I presume I need to use that ID to render the 
details of each card into the body block of card.html.

Would that require editing the card view? All I have at the moment is:

def card(request):
return render(request, 'scrumbuddy/card.html')


So somewhere in here I'd create a reference to *card.id, *and perhaps pass 
the id within a context variable?

Thanks again guys, it feels good to be making some progress! Really 
appreciate your help.

On Wednesday, 14 February 2018 16:07:32 UTC, Melvyn Sopacua wrote:
>
> On woensdag 14 februari 2018 16:14:40 CET Lylio wrote: 
>
> > I'd like to click on one of the items in the list and open up a new page 
> > showing all the database details for that particular list item (title, 
> > description, time of creation, etc). Roughly, would I change the list 
> items 
> > into links: 
> > 
> >  
> >{% for card in cards.all %} 
> > > return render(request, 'scrumbuddy/card.html', context) 
> > 
>
> > On Tuesday, 13 February 2018 14:18:25 UTC, Gonzalo Delgado wrote: 
>
> > > I can assure you using Django for a project like yours is *very* 
> > > straightforward. 
> > > When in doubt, revisit the Django tutorial. This part is a good one 
> for 
> > > where you're at: 
> https://docs.djangoproject.com/en/2.0/intro/tutorial03/ 
>
>
> You did not follow this advice, or you would already know how to tie the 
> url 
> to the primary key of a model instance. It is spelled out there in detail. 
> -- 
> 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/b3d9d3df-b5d4-4ecb-a5bc-ecd4207c8754%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: edit model properties in the admin

2018-02-14 Thread Melvyn Sopacua
On woensdag 14 februari 2018 15:01:15 CET Andy wrote:

> Well, i know this and the related entry is accessible even without
> explicitly defining the related_name. You can change defaults defining the
> related_name, tho.
> But still trying to add a UserInline to the ProfileAdmin wont work due to
> the missing FK on the user model.

Your reasoning is flawed. The model that is inlined never has a foreign key to 
the model that it is inlined with. It is the reverse of the foreign key. 
Foreign keys are not inlined, they are rendered via select widgets.

Something else is preventing this from working and without code and 
corresponding backtrace we cannot diagnose what.

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


Re: Basic note/trello app - how to link model object IDs

2018-02-14 Thread Melvyn Sopacua
On woensdag 14 februari 2018 16:14:40 CET Lylio wrote:

> I'd like to click on one of the items in the list and open up a new page
> showing all the database details for that particular list item (title,
> description, time of creation, etc). Roughly, would I change the list items
> into links:
> 
> 
>{% for card in cards.all %}
> return render(request, 'scrumbuddy/card.html', context)
> 

> On Tuesday, 13 February 2018 14:18:25 UTC, Gonzalo Delgado wrote:

> > I can assure you using Django for a project like yours is *very*
> > straightforward.
> > When in doubt, revisit the Django tutorial. This part is a good one for
> > where you're at: https://docs.djangoproject.com/en/2.0/intro/tutorial03/


You did not follow this advice, or you would already know how to tie the url 
to the primary key of a model instance. It is spelled out there in detail.
-- 
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/2451736.7695DCAJNb%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


RE: Basic note/trello app - how to link model object IDs

2018-02-14 Thread Matthew Pava
You’ll want to use card.get_absolute_url.
See https://docs.djangoproject.com/en/2.0/ref/models/instances/#get-absolute-url
In your get_absolute_url, you should probably use the reverse method to use the 
name of a URL rather than hard-coding it in the method.  That’s the second 
example in that section.

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Lylio
Sent: Wednesday, February 14, 2018 9:15 AM
To: Django users
Subject: Re: Basic note/trello app - how to link model object IDs

Thanks for the reply Gonzalo, I really appreciate the feedback.

So, conceptually I understand how the remaining pieces of this app fit together 
- but could I ask for just a little more of your help as I'm struggling with 
coding the details of what's needed.

Let's start basic - I've got some 'cards' in my database and on one of the web 
pages the title of the card is presented in a list (with some CSS styling to 
present the list item as a rectangle):


   {% for card in cards.all %}
   {{ card.title }}  
   {% endfor %}


I'd like to click on one of the items in the list and open up a new page 
showing all the database details for that particular list item (title, 
description, time of creation, etc). Roughly, would I change the list items 
into links:


   {% for card in cards.all %}
1. To click on a card so it opens up and displays the details, am I right
> to say I should create a card.html file in the templates folder for this?

It isn't necessary, but it is a good idea
What you need is to create a view that renders such template.
I suggest you write your own view function that does that, but what
you'd usually do is just use a generic view and either pass it the
template you want to use, or name the template in a way the generic view
will find it on its own.
See:
https://docs.djangoproject.com/en/2.0/topics/class-based-views/generic-display/

> 2. I'm confused about how Django keeps track of the cards in my app - I
> presume each card object has an ID in the database and I'd need this
ID in
> order to retrieve the card's details when it's clicked - but I'm
unsure of
> how to link the two. In the two pictures above, say someone clicked on
the
> 'class progression' card on the left... I'd like a new page to open up
that
> display the details for that card and allows the user to edit the info or
> completely delete the card.

Yes, in general, every Django model instance has an id (unless you
specifically tell it not to), and you can use it to create urls for the
detail view I mentioned earlier. This is a good start, but you'll later
want to add a SlugField to your Card model, and use that instead of the
id so urls look nicer.

> I'm maybe asking a bit much here - but I'm unsure of how complex these
> requirements are. It feels like it should be *fairly *straightforward.
Any
> thoughts or advice would be greatly appreciated.

I can assure you using Django for a project like yours is *very*
straightforward.
When in doubt, revisit the Django tutorial. This part is a good one for
where you're at: https://docs.djangoproject.com/en/2.0/intro/tutorial03/


--
Gonzalo Delgado
--
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/eee70b8a-daff-453f-bb46-b4c2769d33e9%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/29197cad508a48fe881f19125a52c08f%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: Basic note/trello app - how to link model object IDs

2018-02-14 Thread Lylio
Thanks for the reply Gonzalo, I really appreciate the feedback.

So, conceptually I understand how the remaining pieces of this app fit 
together - but could I ask for just a little more of your help as I'm 
struggling with coding the details of what's needed.

Let's start basic - I've got some 'cards' in my database and on one of the 
web pages the title of the card is presented in a list (with some CSS 
styling to present the list item as a rectangle):


   {% for card in cards.all %}
   {{ card.title }}  
   {% endfor %}



I'd like to click on one of the items in the list and open up a new page 
showing all the database details for that particular list item (title, 
description, time of creation, etc). Roughly, would I change the list items 
into links:


   {% for card in cards.all %}
   
> Hi Lylio, 
>
> On 12/2/18 16:20, Lylio wrote: 
> > 1. To click on a card so it opens up and displays the details, am I 
> right 
> > to say I should create a card.html file in the templates folder for 
> this? 
>
> It isn't necessary, but it is a good idea 
> What you need is to create a view that renders such template. 
> I suggest you write your own view function that does that, but what 
> you'd usually do is just use a generic view and either pass it the 
> template you want to use, or name the template in a way the generic view 
> will find it on its own. 
> See: 
>
> https://docs.djangoproject.com/en/2.0/topics/class-based-views/generic-display/
>  
>
> > 2. I'm confused about how Django keeps track of the cards in my app - I 
> > presume each card object has an ID in the database and I'd need this 
> ID in 
> > order to retrieve the card's details when it's clicked - but I'm 
> unsure of 
> > how to link the two. In the two pictures above, say someone clicked on 
> the 
> > 'class progression' card on the left... I'd like a new page to open up 
> that 
> > display the details for that card and allows the user to edit the info 
> or 
> > completely delete the card. 
>
> Yes, in general, every Django model instance has an id (unless you 
> specifically tell it not to), and you can use it to create urls for the 
> detail view I mentioned earlier. This is a good start, but you'll later 
> want to add a SlugField to your Card model, and use that instead of the 
> id so urls look nicer. 
>
> > I'm maybe asking a bit much here - but I'm unsure of how complex these 
> > requirements are. It feels like it should be *fairly *straightforward. 
> Any 
> > thoughts or advice would be greatly appreciated. 
>
> I can assure you using Django for a project like yours is *very* 
> straightforward. 
> When in doubt, revisit the Django tutorial. This part is a good one for 
> where you're at: https://docs.djangoproject.com/en/2.0/intro/tutorial03/ 
>
>
> -- 
> Gonzalo Delgado 
>

-- 
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/eee70b8a-daff-453f-bb46-b4c2769d33e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: AttributeError: 'module' object has no attribute 'lru_cache' with python 3.6.4 and Django 2.0.2

2018-02-14 Thread Matthew Pava
I’m not familiar with Docker, but I did have to add the path to Python 3.6 DLLs 
in my WSGI configuration in my Apache configuration file.
WSGIPythonPath ${project_path};${virtualenv};C:/Python36/DLLs;

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of PASCUAL Eric
Sent: Wednesday, February 14, 2018 8:52 AM
To: Django users
Subject: Re: AttributeError: 'module' object has no attribute 'lru_cache' with 
python 3.6.4 and Django 2.0.2


Hi,



Normally you shouldn't have to add site-packages in the PYTHONPATH since it is 
supposed to be already. If not, packages installed via "sudo pip install" would 
not be found.



I've packaged a lot of applications in Docker containers, and never had to 
modify PYTHONPATH.



Your problem is maybe be lurking elsewhere than PYTHONPATH, and this change has 
just created a new one which is hiding the original one, but not solving it at 
all.



Best


Eric

From: django-users@googlegroups.com 
> on behalf 
of Greng Fortezza >
Sent: Wednesday, February 14, 2018 3:02:28 PM
To: Django users
Subject: AttributeError: 'module' object has no attribute 'lru_cache' with 
python 3.6.4 and Django 2.0.2

Hi,

I'm trying to set up the following configuration in Docker
python: 3.6.4
Django: 2.0.2
Apache/2.4.10 (Debian)

First, I was getting the error

ImportError: No module named django.core.wsgi

Then I added Django to PYTHONPATH

export PYTHONPATH="/usr/local/lib/python3.6/site-packages"

the previous problem has gone away but now there is another one

AttributeError: 'module' object has no attribute 'lru_cache'

Apache configs contains the following line

WSGIScriptAlias / /www/settings/wsgi.py

where /www/settings/wsgi.py is  actual path to wsgi.py file.

What could be wrong?

Thanks,
Greng
--
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/02803efb-92a9-4958-9a52-f77bee7de89b%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/AM5P193MB008328E4760DBF0DA724D2238CF50%40AM5P193MB0083.EURP193.PROD.OUTLOOK.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/f0cabae1fd6544528668a9494f6dfe03%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError: 'module' object has no attribute 'lru_cache' with python 3.6.4 and Django 2.0.2

2018-02-14 Thread PASCUAL Eric
Hi,


Normally you shouldn't have to add site-packages in the PYTHONPATH since it is 
supposed to be already. If not, packages installed via "sudo pip install" would 
not be found.


I've packaged a lot of applications in Docker containers, and never had to 
modify PYTHONPATH.


Your problem is maybe be lurking elsewhere than PYTHONPATH, and this change has 
just created a new one which is hiding the original one, but not solving it at 
all.


Best


Eric


From: django-users@googlegroups.com  on behalf 
of Greng Fortezza 
Sent: Wednesday, February 14, 2018 3:02:28 PM
To: Django users
Subject: AttributeError: 'module' object has no attribute 'lru_cache' with 
python 3.6.4 and Django 2.0.2

Hi,

I'm trying to set up the following configuration in Docker
python: 3.6.4
Django: 2.0.2
Apache/2.4.10 (Debian)

First, I was getting the error

ImportError: No module named django.core.wsgi

Then I added Django to PYTHONPATH

export PYTHONPATH="/usr/local/lib/python3.6/site-packages"

the previous problem has gone away but now there is another one

AttributeError: 'module' object has no attribute 'lru_cache'

Apache configs contains the following line

WSGIScriptAlias / /www/settings/wsgi.py

where /www/settings/wsgi.py is  actual path to wsgi.py file.

What could be wrong?

Thanks,
Greng

--
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/02803efb-92a9-4958-9a52-f77bee7de89b%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/AM5P193MB008328E4760DBF0DA724D2238CF50%40AM5P193MB0083.EURP193.PROD.OUTLOOK.COM.
For more options, visit https://groups.google.com/d/optout.


Re: Where use JSON in Django?

2018-02-14 Thread Hayk Manukyan
Ok Thank You

вторник, 13 февраля 2018 г., 19:36:27 UTC+1 пользователь M Hashmi написал:
>
> JSON is parsing in and out information from JS to Python or Django in your 
> case directly. For instance let's suppose you have a JS script in your 
> template and you need to pass your context variables into JS code as 
> variables. You can jsonify your request/response to get or post data. 
>
> A good example would be charts, lets suppose you need to show the number 
> of student per class in any project and you want to visually project the 
> quantity. In that case you need to parse your Student model to JS charting 
> scripts. That is where you create JSON request/response objects to supply 
> or capture the events.
>
> Please check this out an try the following link for practice:
>
> https://www.youtube.com/watch?v=B4Vmm3yZPgc
>
> Regards,
>
> Mudassar
>
>
>
> On Tue, Feb 13, 2018 at 7:08 AM, Hayk Manukyan  > wrote:
>
>> Maybe my question is stupid but I want understand where and why developer 
>> need use json.
>> project  on github 
>>  
>> this is my project. In templates used 
>> django tags.
>> Have to need project changes for example from ({% for product in products 
>> %}{{ product }}{% endfor %}) to json?
>> Thank you for your time
>>
>> -- 
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/5402f8e4-0d15-4fe8-a1d6-6f54a0bab451%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/deea7478-06c2-40bf-8cfe-738c84611d80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


AttributeError: 'module' object has no attribute 'lru_cache' with python 3.6.4 and Django 2.0.2

2018-02-14 Thread Greng Fortezza
Hi,

I'm trying to set up the following configuration in Docker
python: 3.6.4
Django: 2.0.2
Apache/2.4.10 (Debian)

First, I was getting the error 

ImportError: No module named django.core.wsgi

Then I added Django to PYTHONPATH

export PYTHONPATH="/usr/local/lib/python3.6/site-packages"

the previous problem has gone away but now there is another one

AttributeError: 'module' object has no attribute 'lru_cache'

Apache configs contains the following line 

WSGIScriptAlias / /www/settings/wsgi.py

where /www/settings/wsgi.py is  actual path to wsgi.py file.

What could be wrong?

Thanks,
Greng

-- 
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/02803efb-92a9-4958-9a52-f77bee7de89b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: edit model properties in the admin

2018-02-14 Thread Andy


Am Mittwoch, 14. Februar 2018 14:45:49 UTC+1 schrieb Adler Neves:
>
> You can have an OneToOneField in the profile referencing Django's User 
> model with `related_name='profile'`, 


Well, i know this and the related entry is accessible even without 
explicitly defining the related_name. You can change defaults defining the 
related_name, tho. 
But still trying to add a UserInline to the ProfileAdmin wont work due to 
the missing FK on the user model.

 

> About the admin interface changing the model, I guess you're somehow 
> editing `models.py` files. Are you making the migrations, applying them to 
> the database and reloading the server? If you're not persisting changes 
> that way, how do you patch models in memory every startup and ensure 
> database schema is compatible with your models?
>

Just for clarification, i dont do any mysterious magic: the property works 
like this:

@property
def username(self):
return self.user.username
username.fget.short_description = "Username"

@username.setter
def username(self, username):
self.user.username = username
self.user.save()


So with everything else failing .. although i only want to be able to edit 
this one field of the actual user, it looks like i have to show a useradmin 
with a profile inline admin?
AFAIK this can only be done with a separate admin site, because there can 
only be one Admin for any model thats why i wanted to have some other 
solution. 

Maybe someone knows a better solution?
 

 

-- 
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/c3165e95-7be7-42bb-824f-fc52aed080f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: edit model properties in the admin

2018-02-14 Thread Adler Neves
You can have an OneToOneField in the profile referencing Django's User model 
with `related_name='profile'`, so you can access information from there as 
`user.profile.birthday`. An useful link: 
https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html

About the admin interface changing the model, I guess you're somehow editing 
`models.py` files. Are you making the migrations, applying them to the database 
and reloading the server? If you're not persisting changes that way, how do you 
patch models in memory every startup and ensure database schema is compatible 
with your models?

-- 
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/3c67e1be-d032-42d4-b888-c3eb34ce02da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: edit model properties in the admin

2018-02-14 Thread Andy
As an example i wanted to have the username editable inside the profile. 
Since the Django default user doesnt have a foreign key to profile i cant 
just use an inline admin for the user model, so my next idea was to solve 
it with properties just getting from and saving to the related user model.

Am Mittwoch, 14. Februar 2018 13:54:30 UTC+1 schrieb Gonzalo Delgado:
>
> On 14/2/18 08:05, Andy wrote: 
> > Im trying to have a custom admin that is also able to edit some model 
> > properties, but putting those properties into my fieldsets its 
> complaining 
>
> What would mean to edit a property (assuming this means an attribute 
> that isn't a model field) in your app? Where would the data go? 
>
> > Unknown field(s) (foo, bar) specified for Profile. Check 
> fields/fieldsets/exclude attributes of class ProfileAdmin. 
> > The properties work in list_display, but im missing something for the 
> edit page. 
>
>
> The Django admin will look only for Django fields in the edit forms, 
> that's why you're getting the errors. 
> Since list_display is only for showing data, it will display any 
> attribute in your model. 
>
> > Can i actually do this? So far i didnt find any hint on editing 
> properties with the admin. 
>
> What you can do is use a custom model form and add fields to it for the 
> attributes you want to be able to "edit", but you'll also need to define 
> what happens with the data either in the custom form class itself, or in 
> the ModelAdmin class by extending the change_view method. 
>
> See the documentation for details: 
>
> https://docs.djangoproject.com/en/2.0/ref/contrib/admin/#django.contrib.admin.ModelAdmin.form
>  
>
> -- 
> Gonzalo Delgado 
>

-- 
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/2c65aa7c-3695-49dd-8769-a5b940997917%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: edit model properties in the admin

2018-02-14 Thread Gonzalo Delgado
On 14/2/18 08:05, Andy wrote:
> Im trying to have a custom admin that is also able to edit some model 
> properties, but putting those properties into my fieldsets its complaining

What would mean to edit a property (assuming this means an attribute
that isn't a model field) in your app? Where would the data go?

> Unknown field(s) (foo, bar) specified for Profile. Check 
> fields/fieldsets/exclude attributes of class ProfileAdmin.
> The properties work in list_display, but im missing something for the edit 
> page.


The Django admin will look only for Django fields in the edit forms,
that's why you're getting the errors.
Since list_display is only for showing data, it will display any
attribute in your model.

> Can i actually do this? So far i didnt find any hint on editing properties 
> with the admin.

What you can do is use a custom model form and add fields to it for the
attributes you want to be able to "edit", but you'll also need to define
what happens with the data either in the custom form class itself, or in
the ModelAdmin class by extending the change_view method.

See the documentation for details:
https://docs.djangoproject.com/en/2.0/ref/contrib/admin/#django.contrib.admin.ModelAdmin.form

-- 
Gonzalo Delgado

-- 
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/27737ad2-0218-998a-054b-037054bf5bba%40gonzalodelgado.com.ar.
For more options, visit https://groups.google.com/d/optout.


Re: importError: Count Not import Django inside Virtualenv

2018-02-14 Thread PASCUAL Eric
Hi Etienne,

I prefer messing with standard distutils/setuptools commands to avoid 
situations like this... ;-)

Messing and restoring system libs is a matter of personnal taste 


Eric


From: Etienne Robillard 
Sent: Wednesday, February 14, 2018 11:07:07 AM
To: PASCUAL Eric
Cc: django-users@googlegroups.com
Subject: Re: importError: Count Not import Django inside Virtualenv


Hi Eric,

Le 2018-02-14 à 03:44, PASCUAL Eric a écrit :

Hi,


Hard to say without knowing the exact context, but my gut feeling is that 
you've modified a system wide library at a moment (maybe inadvertently).


My own experience is that it's easy to mess with Python libraries when 
installing packages with sudo , which may happen form time to  time when 
working with virtualenv (or pyenv) since not very long, and being caught up by 
old habits (they tend to survive longer that wanted ).


I prefer messing with standard distutils/setuptools commands to avoid 
situations like this... ;-)

Cheers,
Etienne



From: django-users@googlegroups.com 
 on behalf 
of tango ward 
Sent: Wednesday, February 14, 2018 3:40:04 AM
To: django-users@googlegroups.com
Subject: Re: importError: Count Not import Django inside Virtualenv

Hi Eric,


I tried what you suggested and it works! I was just wondering why my existing 
pet projects have the same problem?

On Wed, Feb 14, 2018 at 10:13 AM, tango ward 
> wrote:
Hi,

The error message that I am getting is:

Traceback (most recent call last):
  File "manage.py", line 8, in 
from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 14, in 
) from exc
ImportError: Couldn't import Django. Are you sure it's installed and available 
on your PYTHONPATH environment variable? Did you forget to activate a virtual 
environment?


@Jason,

It's weird because couple of days, I can still run these pet projects without 
any error. If I go to venv folder virtual/lib/python3.6/site-packages, I can 
see django there. It seems that even though virtualenv is activated, the 
packages I installed inside it are not recognized by the system.


On Wed, Feb 14, 2018 at 5:38 AM, PASCUAL Eric 
> wrote:

Hi Jarvis,


Can you provide the error messages trace ? It can greatly help understanding 
what's happening.


If you haven't already done this, try to restart from a fresh new virtualenv 
inside which you'll install Django and the additional packages you've added (if 
any). Then restore a copy of your project in this context (if by chance you 
work with git, a simple git clone will do the trick) and test your app again.


Hoping you haven't already messed your system Python by installing stuff in 
sudo mode. The situation could be a little more complicated then.


Best.


Eric

From: django-users@googlegroups.com 
> on behalf 
of tango ward >
Sent: Tuesday, February 13, 2018 9:43:45 PM
To: django-users@googlegroups.com
Subject: importError: Count Not import Django inside Virtualenv

Hi,

I want to seek some advice about the error. All of my pet projects in my 
desktop are getting the same error even though virtualenv is activated. I can 
confirm that when I started playing around with the projects, I have installed 
Django inside virtualenv without using "sudo". Now, I can't run python 
manage.py runserver and the packages that I am getting whenever I run pip 
freeze are different from before which doesn't include Django in the list.


Any advice pls?


Thanks,
Jarvis
--
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/CAA6wQLKp3oz-6FfDzQ%3Dip4XRsuLPSeOCuwkbUuWbe1JNx2YhFA%40mail.gmail.com.
For more options, visit 

Re: importError: Count Not import Django inside Virtualenv

2018-02-14 Thread PASCUAL Eric
Hi,


The copy/paste of the project tree will work of course. Chances are that 
unwanted files can be brought too, but this should not be a problem in a first 
stage.


I have used rsync or tar archives to deploy Django projects in some cases, and 
it worked fine.


Eric


From: django-users@googlegroups.com  on behalf 
of tango ward 
Sent: Wednesday, February 14, 2018 10:09:51 AM
To: django-users@googlegroups.com
Subject: Re: importError: Count Not import Django inside Virtualenv

that's odd. Whenever I test a pacakge, it's always installed first in 
virtualenv. Maybe when I updated my system? Btw, I have some projects which are 
not yet in github, can I just copy and paste them in a new folder with new 
virtualenv?

On Wed, Feb 14, 2018 at 4:44 PM, PASCUAL Eric 
> wrote:

Hi,


Hard to say without knowing the exact context, but my gut feeling is that 
you've modified a system wide library at a moment (maybe inadvertently).


My own experience is that it's easy to mess with Python libraries when 
installing packages with sudo , which may happen form time to  time when 
working with virtualenv (or pyenv) since not very long, and being caught up by 
old habits (they tend to survive longer that wanted ).


Even if far less harmful, then --user option is to avoid for projects related 
libs, for the same reasons.


Eric

From: django-users@googlegroups.com 
> on behalf 
of tango ward >
Sent: Wednesday, February 14, 2018 3:40:04 AM
To: django-users@googlegroups.com
Subject: Re: importError: Count Not import Django inside Virtualenv

Hi Eric,


I tried what you suggested and it works! I was just wondering why my existing 
pet projects have the same problem?

On Wed, Feb 14, 2018 at 10:13 AM, tango ward 
> wrote:
Hi,

The error message that I am getting is:

Traceback (most recent call last):
  File "manage.py", line 8, in 
from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 14, in 
) from exc
ImportError: Couldn't import Django. Are you sure it's installed and available 
on your PYTHONPATH environment variable? Did you forget to activate a virtual 
environment?


@Jason,

It's weird because couple of days, I can still run these pet projects without 
any error. If I go to venv folder virtual/lib/python3.6/site-packages, I can 
see django there. It seems that even though virtualenv is activated, the 
packages I installed inside it are not recognized by the system.


On Wed, Feb 14, 2018 at 5:38 AM, PASCUAL Eric 
> wrote:

Hi Jarvis,


Can you provide the error messages trace ? It can greatly help understanding 
what's happening.


If you haven't already done this, try to restart from a fresh new virtualenv 
inside which you'll install Django and the additional packages you've added (if 
any). Then restore a copy of your project in this context (if by chance you 
work with git, a simple git clone will do the trick) and test your app again.


Hoping you haven't already messed your system Python by installing stuff in 
sudo mode. The situation could be a little more complicated then.


Best.


Eric

From: django-users@googlegroups.com 
> on behalf 
of tango ward >
Sent: Tuesday, February 13, 2018 9:43:45 PM
To: django-users@googlegroups.com
Subject: importError: Count Not import Django inside Virtualenv

Hi,

I want to seek some advice about the error. All of my pet projects in my 
desktop are getting the same error even though virtualenv is activated. I can 
confirm that when I started playing around with the projects, I have installed 
Django inside virtualenv without using "sudo". Now, I can't run python 
manage.py runserver and the packages that I am getting whenever I run pip 
freeze are different from before which doesn't include Django in the list.


Any advice pls?


Thanks,
Jarvis

--
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 

edit model properties in the admin

2018-02-14 Thread Andy
Im trying to have a custom admin that is also able to edit some model 
properties, but putting those properties into my fieldsets its complaining

Unknown field(s) (foo, bar) specified for Profile. Check 
fields/fieldsets/exclude attributes of class ProfileAdmin.

The properties work in list_display, but im missing something for the edit page.
Can i actually do this? So far i didnt find any hint on editing properties with 
the admin.

-- 
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/cadb37cd-6ac6-43e1-8f96-dade54bd8aa1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: importError: Count Not import Django inside Virtualenv

2018-02-14 Thread Etienne Robillard

Hi Eric,


Le 2018-02-14 à 03:44, PASCUAL Eric a écrit :


Hi,


Hard to say without knowing the exact context, but my gut feeling is 
that you've modified a system wide library at a moment (maybe 
inadvertently).



My own experience is that it's easy to mess with Python libraries when 
installing packages with sudo , which may happen form time to  time 
when working with virtualenv (or pyenv) since not very long, and being 
caught up by old habits (they tend to survive longer that wanted ).



I prefer messing with standard distutils/setuptools commands to avoid 
situations like this... ;-)


Cheers,
Etienne




*From:* django-users@googlegroups.com  
on behalf of tango ward 

*Sent:* Wednesday, February 14, 2018 3:40:04 AM
*To:* django-users@googlegroups.com
*Subject:* Re: importError: Count Not import Django inside Virtualenv
Hi Eric,


I tried what you suggested and it works! I was just wondering why my 
existing pet projects have the same problem?


On Wed, Feb 14, 2018 at 10:13 AM, tango ward > wrote:


Hi,

The error message that I am getting is:

Traceback (most recent call last):
  File "manage.py", line 8, in 
    from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 14, in 
    ) from exc
ImportError: Couldn't import Django. Are you sure it's installed
and available on your PYTHONPATH environment variable? Did you
forget to activate a virtual environment?


@Jason,

It's weird because couple of days, I can still run these pet
projects without any error. If I go to venv folder
virtual/lib/python3.6/site-packages, I can see django there. It
seems that even though virtualenv is activated, the packages I
installed inside it are not recognized by the system.


On Wed, Feb 14, 2018 at 5:38 AM, PASCUAL Eric
> wrote:

Hi Jarvis,


Can you provide the error messages trace ? It can greatly help
understanding what's happening.


If you haven't already done this, try to restart from a fresh
new virtualenv inside which you'll install Django and the
additional packages you've added (if any). Then restore a copy
of your project in this context (if by chance you work with
git, a simple git clone will do the trick) and test your app
again.


Hoping you haven't already messed your system Python by
installing stuff in sudo mode. The situation could be a little
more complicated then.


Best.


Eric

*From:* django-users@googlegroups.com

> on behalf of tango
ward >
*Sent:* Tuesday, February 13, 2018 9:43:45 PM
*To:* django-users@googlegroups.com

*Subject:* importError: Count Not import Django inside Virtualenv
Hi,

I want to seek some advice about the error. All of my pet
projects in my desktop are getting the same error even though
virtualenv is activated. I can confirm that when I started
playing around with the projects, I have installed Django
inside virtualenv without using "sudo". Now, I can't run
python manage.py runserver and the packages that I am getting
whenever I run pip freeze are different from before which
doesn't include Django in the list.


Any advice pls?


Thanks,
Jarvis
-- 
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/CAA6wQLKp3oz-6FfDzQ%3Dip4XRsuLPSeOCuwkbUuWbe1JNx2YhFA%40mail.gmail.com


Re: importError: Count Not import Django inside Virtualenv

2018-02-14 Thread tango ward
that's odd. Whenever I test a pacakge, it's always installed first in
virtualenv. Maybe when I updated my system? Btw, I have some projects which
are not yet in github, can I just copy and paste them in a new folder with
new virtualenv?

On Wed, Feb 14, 2018 at 4:44 PM, PASCUAL Eric  wrote:

> Hi,
>
>
> Hard to say without knowing the exact context, but my gut feeling is that
> you've modified a system wide library at a moment (maybe inadvertently).
>
>
> My own experience is that it's easy to mess with Python libraries when
> installing packages with sudo , which may happen form time to  time
> when working with virtualenv (or pyenv) since not very long, and being
> caught up by old habits (they tend to survive longer that wanted ).
>
>
> Even if far less harmful, then --user option is to avoid for projects
> related libs, for the same reasons.
>
>
> Eric
> --
> *From:* django-users@googlegroups.com  on
> behalf of tango ward 
> *Sent:* Wednesday, February 14, 2018 3:40:04 AM
> *To:* django-users@googlegroups.com
> *Subject:* Re: importError: Count Not import Django inside Virtualenv
>
> Hi Eric,
>
>
> I tried what you suggested and it works! I was just wondering why my
> existing pet projects have the same problem?
>
> On Wed, Feb 14, 2018 at 10:13 AM, tango ward 
> wrote:
>
> Hi,
>
> The error message that I am getting is:
>
> Traceback (most recent call last):
>   File "manage.py", line 8, in 
> from django.core.management import execute_from_command_line
> ModuleNotFoundError: No module named 'django'
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
>   File "manage.py", line 14, in 
> ) from exc
> ImportError: Couldn't import Django. Are you sure it's installed and
> available on your PYTHONPATH environment variable? Did you forget to
> activate a virtual environment?
>
>
> @Jason,
>
> It's weird because couple of days, I can still run these pet projects
> without any error. If I go to venv folder virtual/lib/python3.6/site-packages,
> I can see django there. It seems that even though virtualenv is activated,
> the packages I installed inside it are not recognized by the system.
>
>
> On Wed, Feb 14, 2018 at 5:38 AM, PASCUAL Eric 
> wrote:
>
> Hi Jarvis,
>
>
> Can you provide the error messages trace ? It can greatly help
> understanding what's happening.
>
>
> If you haven't already done this, try to restart from a fresh new
> virtualenv inside which you'll install Django and the additional packages
> you've added (if any). Then restore a copy of your project in this context
> (if by chance you work with git, a simple git clone will do the trick) and
> test your app again.
>
>
> Hoping you haven't already messed your system Python by installing stuff
> in sudo mode. The situation could be a little more complicated then.
>
>
> Best.
>
>
> Eric
> --
> *From:* django-users@googlegroups.com  on
> behalf of tango ward 
> *Sent:* Tuesday, February 13, 2018 9:43:45 PM
> *To:* django-users@googlegroups.com
> *Subject:* importError: Count Not import Django inside Virtualenv
>
> Hi,
>
> I want to seek some advice about the error. All of my pet projects in my
> desktop are getting the same error even though virtualenv is activated. I
> can confirm that when I started playing around with the projects, I have
> installed Django inside virtualenv without using "sudo". Now, I can't run
> python manage.py runserver and the packages that I am getting whenever I
> run pip freeze are different from before which doesn't include Django in
> the list.
>
>
> Any advice pls?
>
>
> Thanks,
> Jarvis
>
> --
> 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/CAA6wQLKp3oz-6FfDzQ%3Dip4XRsuLPSeOCuwkbUuWb
> e1JNx2YhFA%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 

Re: Syntax Error when trying to migrate to Postgresql

2018-02-14 Thread Andy
Could you post a few more lines of this settings.py? Preferably the whole 
DATABASES definition.

Just in case there actually is a weird invisible character try retyping 
'postgresql', but more likely it looks as if you are using wrong quotation 
marks other than ' or ". I dont even have on my keyboard whats in your 
error message.


Am Mittwoch, 14. Februar 2018 01:17:43 UTC+1 schrieb Joe:
>
> I have installed django, Postgresql, and psycopg2 and went to migrate a 
> project to a new database I created on postgresql, This is the error 
> message I got. 
>
> Traceback (most recent call last):
>
>   File "manage.py", line 15, in 
>
> execute_from_command_line(sys.argv)
>
>   File 
> "/Users/JosephConrad/Desktop/Joetestsite/lib/python3.6/site-packages/django/core/management/__init__.py",
>  
> line 371, in execute_from_command_line
>
> utility.execute()
>
>   File 
> "/Users/JosephConrad/Desktop/Joetestsite/lib/python3.6/site-packages/django/core/management/__init__.py",
>  
> line 317, in execute
>
> settings.INSTALLED_APPS
>
>   File 
> "/Users/JosephConrad/Desktop/Joetestsite/lib/python3.6/site-packages/django/conf/__init__.py",
>  
> line 56, in __getattr__
>
> self._setup(name)
>
>   File 
> "/Users/JosephConrad/Desktop/Joetestsite/lib/python3.6/site-packages/django/conf/__init__.py",
>  
> line 43, in _setup
>
> self._wrapped = Settings(settings_module)
>
>   File 
> "/Users/JosephConrad/Desktop/Joetestsite/lib/python3.6/site-packages/django/conf/__init__.py",
>  
> line 106, in __init__
>
> mod = importlib.import_module(self.SETTINGS_MODULE)
>
>   File 
> "/Users/JosephConrad/Desktop/Joetestsite/lib/python3.6/importlib/__init__.py",
>  
> line 126, in import_module
>
> return _bootstrap._gcd_import(name[level:], package, level)
>
>   File "", line 978, in _gcd_import
>
>   File "", line 961, in _find_and_load
>
>   File "", line 950, in 
> _find_and_load_unlocked
>
>   File "", line 655, in _load_unlocked
>
>   File "", line 674, in exec_module
>
>   File "", line 781, in get_code
>
>   File "", line 741, in 
> source_to_code
>
>   File "", line 205, in 
> _call_with_frames_removed
>
>   File 
> "/Users/JosephConrad/Desktop/Joetestsite/MySite/BudgetSite/settings.py", 
> line 77
>
> ‘postgresql’: {
>
>^
>
> SyntaxError: invalid character in identifier
>
>
>
> I am able to migrate with sqllite but I can't migrate to postgresql.
>

-- 
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/4a39755e-c408-4f6f-93a2-bde83fbc2bbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: importError: Count Not import Django inside Virtualenv

2018-02-14 Thread PASCUAL Eric
Hi,


Hard to say without knowing the exact context, but my gut feeling is that 
you've modified a system wide library at a moment (maybe inadvertently).


My own experience is that it's easy to mess with Python libraries when 
installing packages with sudo , which may happen form time to  time when 
working with virtualenv (or pyenv) since not very long, and being caught up by 
old habits (they tend to survive longer that wanted ).


Even if far less harmful, then --user option is to avoid for projects related 
libs, for the same reasons.


Eric

From: django-users@googlegroups.com  on behalf 
of tango ward 
Sent: Wednesday, February 14, 2018 3:40:04 AM
To: django-users@googlegroups.com
Subject: Re: importError: Count Not import Django inside Virtualenv

Hi Eric,


I tried what you suggested and it works! I was just wondering why my existing 
pet projects have the same problem?

On Wed, Feb 14, 2018 at 10:13 AM, tango ward 
> wrote:
Hi,

The error message that I am getting is:

Traceback (most recent call last):
  File "manage.py", line 8, in 
from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 14, in 
) from exc
ImportError: Couldn't import Django. Are you sure it's installed and available 
on your PYTHONPATH environment variable? Did you forget to activate a virtual 
environment?


@Jason,

It's weird because couple of days, I can still run these pet projects without 
any error. If I go to venv folder virtual/lib/python3.6/site-packages, I can 
see django there. It seems that even though virtualenv is activated, the 
packages I installed inside it are not recognized by the system.


On Wed, Feb 14, 2018 at 5:38 AM, PASCUAL Eric 
> wrote:

Hi Jarvis,


Can you provide the error messages trace ? It can greatly help understanding 
what's happening.


If you haven't already done this, try to restart from a fresh new virtualenv 
inside which you'll install Django and the additional packages you've added (if 
any). Then restore a copy of your project in this context (if by chance you 
work with git, a simple git clone will do the trick) and test your app again.


Hoping you haven't already messed your system Python by installing stuff in 
sudo mode. The situation could be a little more complicated then.


Best.


Eric

From: django-users@googlegroups.com 
> on behalf 
of tango ward >
Sent: Tuesday, February 13, 2018 9:43:45 PM
To: django-users@googlegroups.com
Subject: importError: Count Not import Django inside Virtualenv

Hi,

I want to seek some advice about the error. All of my pet projects in my 
desktop are getting the same error even though virtualenv is activated. I can 
confirm that when I started playing around with the projects, I have installed 
Django inside virtualenv without using "sudo". Now, I can't run python 
manage.py runserver and the packages that I am getting whenever I run pip 
freeze are different from before which doesn't include Django in the list.


Any advice pls?


Thanks,
Jarvis

--
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/CAA6wQLKp3oz-6FfDzQ%3Dip4XRsuLPSeOCuwkbUuWbe1JNx2YhFA%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