ModuleNotFoundError: No module named 'sample,'

2019-03-07 Thread lakshmyyreddy
Hi Team

My project name is Sample
While I am trying to connect database with models.py 
I am finding these type of errors
ModuleNotFoundError: No module named 'sample,'
Can anybody 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/94eba992-1553-40a5-8a58-4f9ad85bbd5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ModuleNotFoundError: No module named 'sample,'

2019-03-07 Thread Robin Riis
from .models import Sample

Den tors 7 mars 2019 10:44  skrev:

> Hi Team
>
> My project name is Sample
> While I am trying to connect database with models.py
> I am finding these type of errors
> ModuleNotFoundError: No module named 'sample,'
> Can anybody 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/94eba992-1553-40a5-8a58-4f9ad85bbd5c%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/CAPLZMbNwyb0esCbJgR50oxrw_kaXSH4m8COB83Nw7nVfP6DE9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ModuleNotFoundError: No module named 'sample,'

2019-03-07 Thread Alex Kimeu
Do you have a model named Sample in your models.py file of your app??

On Thu, 7 Mar 2019, 13:00 Robin Riis,  wrote:

> from .models import Sample
>
> Den tors 7 mars 2019 10:44  skrev:
>
>> Hi Team
>>
>> My project name is Sample
>> While I am trying to connect database with models.py
>> I am finding these type of errors
>> ModuleNotFoundError: No module named 'sample,'
>> Can anybody 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/94eba992-1553-40a5-8a58-4f9ad85bbd5c%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/CAPLZMbNwyb0esCbJgR50oxrw_kaXSH4m8COB83Nw7nVfP6DE9A%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/CACYP3VHp7ZWo5Gpjx_kiJdCSu0siSxHTicm88%3DjaqO%2BZf455ug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Looking for a cool co-founder / remote possible

2019-03-07 Thread ExpoTor com
ExpoTor.com is a young remote-first start-up in Germany looking for an
ambition experienced full-stack Python(React) Developer to join our journey


With our SaaS solution, we help SMEs at trade shows get more ROI and
freelancers get more exposure and sell more in the MICE space. Time- and
money-wasting exhibiting must be passé – we will give them back the
hundreds of hours they spend for it during a year.

Our mission is to „make the small ones big again“ by matching the right
demand-offer we can help a lot of small businesses and even individuals
with the first mobile and web-based expo platform that allows effective
decision making by digitally transforming the global exhibiting process. We
reduce waste by cutting financial, administrative and repetitive work. We
save CO2 and reduce waste around the MICE industry!



As a co-founder and automation engineer/developer, you will be improving
the technical logic and generate growth through your innovative
technological input. Your work will contribute to the excellence of our
software based on Django, MySQL, jQuery, BS, etc. Our goal is to create a
product, which can compete with any other MICE application.

 You should bring…

   - 5+ years of hands-on experience developing, releasing, automated
   unit/regression testing and maintaining large-scale software applications
   (web/mobile) with Python/Django
   - 2+ years of professional experience with enterprise architecture and
   developing highly scalable websites/services
   - experience in introducing blockchain for SaaS products/platforms
   - some experience with React JS and React Native would be great – as
   future CTO and tech decision-maker, it is important to bring full-stack
   experience
   - a university degree is not important
   - freelancing / own startup experience would be great
   - respecting deadlines and bringing the initiative



If you already have software in SaaS / AI CRM / blockchain / Smart
Contracts and looking to find a match to market it – we are happy to talk
about a merge/co-founding. We appreciate creativity and open-minded people.
We encourage only people who really want to make-it-happen and bring a
value-added contribution to contact us. Those looking for a sleeping 9-5
job would not be at the right place here.



For more info feel free to contact Alex at welc...@expotor.com

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


Re: My developers have run amok

2019-03-07 Thread Derek
I am not sure I understand about the "size and synchronization" but I 
assume that is to do with them not giving you adequate infrastructure.

I don't think the DB advice is in any way specific to Django - I'd make the 
same recommendation regardless of the framework being adopted - but 
obviously there are sometimes constraints that force our hand to do things 
in non-optimal ways.  You have my sympathies (for what they are worth).

On Monday, 4 March 2019 16:30:04 UTC+2, Dan Davis wrote:
>
> Derek, it all depends on where you are.  I'm \at a government agency.  The 
> wait time to get an NFS directory (yup, really) where I can write my data 
> between multiple redundant web servers is weeks.  After that, there are 
> size and synchronization issues.   So, there are other reasons than table 
> design to consider.  After all, we don't do the work to put our tables in 
> 1NF, 2NF, 3NF just because - we do it if our data is going to be used for 
> OLAP, but prefer less normalized structures for OLTP.
>
> I just think it is interesting that the standard advice about files in the 
> database has to do with Django's standard operations, and maybe ignores the 
> realities on the ground for some developers.
>
> On Mon, Mar 4, 2019 at 2:11 AM Derek > 
> wrote:
>
>> Just because something can be done, does not mean it should be done.
>>
>> I have always avoided putting large binary files into the DB - why?  
>> Primarily because the information in them is "dead" - very hard to search 
>> or filter, which rather defeats the point of using a DB.  Rather leave them 
>> on disc and add a pointer to each of them.  For one app, I did convert all 
>> the data in their files (typically Excel or PDF) into "raw text" and stored 
>> that text in the DB so it was, at least, searchable (but obviously not 
>> really viewable in that state).
>>
>> Also, a call like:
>>
>> ModelWithFileContents.objects.all()
>>
>> Can be quite overwhelming unless you know what you are doing; rather look 
>> to extract specific fields that you know you want to display/access.  I 
>> would imagine that the only time you are going to want to retrieve that 
>> BLOB (assuming you stick to your current design) is per individual record 
>> "on request".
>>
>>
>> On Wednesday, 27 February 2019 03:18:00 UTC+2, Dan Davis wrote:
>>>
>>> For the group, the eventual culprit was not complicated.  It is a model 
>>> with a BinaryField that holds a file's contents. The Django documentation 
>>> advises against this, but why?   Well, on-premise with big-iron database 
>>> like Oracle, storing the file in the database is attractive.  So, what's 
>>> the problem?
>>>
>>>   ModelWithFileContents.objects.all()
>>>
>>> There you go, even if you are not using the file, its contents will be 
>>> fetched into memory.
>>> The solution if it must be at the Django level is to use defer() 
>>> properly, and add it to the ModelManager.
>>>
>>> What I did is to make sure the developer *always* used a database view 
>>> that doesn't have the binary field for most operations.
>>>
>> -- 
>> 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/TZ682yh2QfE/unsubscribe.
>> To unsubscribe from this group and all its topics, 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/b4e09fb6-b426-455d-aa3c-7191da404fc1%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/875d3cc7-5b25-4a5a-a1a9-5248b0c21c59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: migrating from 2.7 to 3.x on Ubuntu

2019-03-07 Thread Ryan Nowakowski
Seems doable. I would leave nginx out of it and just run gunicorn Python 3 with 
Apache. Also I would do the release upgrade before.

On March 4, 2019 10:40:21 PM CST, Mike Dewhirst  wrote:
>On the same host, is it viable to switch my Django projects away from 
>vhosts under Apache2/mod_wsgi/py2.7 to Gunicorn and Nginx running with 
>Python 3.x ...
>
>AND SIMULTANEOUSLY
>
>... leave Trac running on Apache2 mod_wsgi/py2.7?
>
>Trac is not yet released for Python 3.x. There is also a Subversion 
>server running via Apache2 so it looks like I need to keep Apache2 
>anyway.  I also have Buildbot running under Python 2.7 on that machine 
>but it runs on Twisted so I expect that will be a regular migration.
>
>As a bonus question,  if this is even possible, would you 
>do-release-upgrade Ubuntu 16.04 to 18.04 before or after such a
>migration.
>
>Thanks for any sympathy as well as advice.
>
>
>-- 
>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/212ea0c7-9f08-11cc-22b8-ab96384aa31f%40dewhirst.com.au.
>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/13C53DB6-22AB-419D-B11E-3B606B9C3B68%40fattuba.com.
For more options, visit https://groups.google.com/d/optout.


Hi to all

2019-03-07 Thread Devendra reddy
how to create the spam in django send me code if any one have

-- 
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/CABB0Uf33O4%3DsiuNFYsf5_Eus3%3D6ji99YBhdG%3DTaz6KrCRnCBGQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


linking django app to slurm db

2019-03-07 Thread Bissane Belhadji
Hi everyone!
I've been working on this project with SLURM for quite a while now and I've 
been experiencing a massive writer's block, I'm working on a portal that 
will allow employees register to slurm's database and run their jobs on 
accounts along with several other things.  I have built this django 
application with an LDAP and Kerberos backend to authenticate against the 
corporate internal authentication system and I'm sorte of familiar with how 
slurm works now, however, I can't for the life of me figure out how to link 
my django app to the slurm db 
I have a few ideas in mind that I'm currently testing out, but any new 
approach to this or even the slightest suggestion is greatly appreciated 

-- 
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/df27cd9e--4140-afdb-343aeb356c1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problems with first program

2019-03-07 Thread Ranganath Kulkarni
Always use editors like pycharm which will take care of indentation if not 
it will complain syntax errors if there are any in your program.

On Thursday, February 28, 2019 at 11:14:33 PM UTC, Edvani Pascoal wrote:
>
> hey guys I'm beginner on django I never worked with this framework before 
> and then I've problems to started polls app this is the error:
> (my_env) root@ubuntu:~/django-test/djangoproject# python manage.py 
> runserver 192.168.184.202:8000
>
>
> Unhandled exception in thread started by  check_errors..wrapper at 0x7fa7af08b9d8>
> Traceback (most recent call last):
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 225, in wrapper
> fn(*args, **kwargs)
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
>  
> line 109, in inner_run
> autoreload.raise_last_exception()
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 248, in raise_last_exception
> raise _exception[1]
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/core/management/__init__.py",
>  
> line 337, in execute
> autoreload.check_errors(django.setup)()
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/utils/autoreload.py",
>  
> line 225, in wrapper
> fn(*args, **kwargs)
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/__init__.py",
>  
> line 24, in setup
> apps.populate(settings.INSTALLED_APPS)
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/apps/registry.py",
>  
> line 112, in populate
> app_config.import_models()
>   File 
> "/home/edvani/django-test/my_env/lib/python3.6/site-packages/django/apps/config.py",
>  
> line 198, in import_models
> self.models_module = import_module(models_module_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 674, in exec_module
>   File "", line 781, in get_code
>   File "", line 741, in 
> source_to_code
>   File "", line 219, in 
> _call_with_frames_removed
>   File "/home/edvani/django-test/djangoproject/polls/models.py", line 5
> question_text = models.CharField(max_length=200)
> ^
> IndentationError: expected an indented block
>
>
> I need help how to solve this??
>

-- 
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/1a2cad82-cf7a-421a-88df-279955713233%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ModuleNotFoundError: No module named 'sample,'

2019-03-07 Thread 赖信桃
Did you add `sample` to INSTALLED_APPS?

 于2019年3月7日周四 下午5:44写道:

> Hi Team
>
> My project name is Sample
> While I am trying to connect database with models.py
> I am finding these type of errors
> ModuleNotFoundError: No module named 'sample,'
> Can anybody 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/94eba992-1553-40a5-8a58-4f9ad85bbd5c%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/CAMv51WQyTPD3ZQu8XxZmGBYTTm%3DdWignBi-4KAg5St-0Yf9Oqw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How can I make users login to my site with facebook/twitter/google?

2019-03-07 Thread Ryan Nowakowski
For your https problem I recommend a service like localtunnel or ngrok.

On March 5, 2019 11:19:16 AM CST, Sandip Nath  wrote:
>i want users to my site to log log in with facebook, twitter, google.
>While 
>the development server supports only http fb/twitter/google expects
>https. 
>What to do?
>
>-- 
>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/53f8baf2-04d4-4be9-9ce0-e9a98d5d9657%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/C8363AA8-D7F3-4018-954A-9CC0881A5AA4%40fattuba.com.
For more options, visit https://groups.google.com/d/optout.


Django credit card redaction app - - MultiValueDictKeyError

2019-03-07 Thread drone4four


Hello!

I’m trying to run a basic Django app which redacts a 16 digit number 
entered by the user. I had a it running a few minutes ago. I’m not sure 
what I changed, but now I am getting a MultiValueDictKeyError. I’ve triple 
checked every variable. The only dictionary in my project is in views.py at 
line 7. As far as I can tell, it’s all accurate and positioned correctly. I 
don’t recall changing this dictionary or any other operator around this 
line. I’m stumped. What would you people suggest? Have a look at my setup.


*Here is the error and traceback in full:* https://pastebin.com/QwSrmAJx 

Here is my urls.py:
from django.conf.urls import  include, url



from django.contrib import admin

from django.urls import path

from . import views


urlpatterns = [

   url(r'^admin/', admin.site.urls),

   url(r'^$', views.home, name='home'),



views.py:
from django.http import HttpResponse



from django.shortcuts import render


def home(request):

   number = request.GET['ccEntry']

   redacted_num = '   {}'.format(number[-4:])

   return render(request, 'home.html', {'number':number, 'redacted_num':
redacted_num})



home.html template:









 

   Enter your fake Chuckee Cheese Neptune credit card number!

   

 

 

 

   Must be a 16 digit number.

 

 

   

   

   

   

   Original Card Number:

   

   {{ number }}

   

   Redacted Card Number:

   

   {{ redacted_num }}

   

Did this work?   

   





-- 
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/49da3086-6f3d-415b-b451-7e4c6a6e542c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django credit card redaction app - - MultiValueDictKeyError

2019-03-07 Thread Sam Taiwo
I would be careful how you pass the data on get, somewhere in your front
end code you are probably not passing the data through as you expected.
Instead of using .GET, use .GET.get to get your data. This will either
return the value you want, or none. I think you have made the error of not
passing your data to the get header as you didn't explicitly write this on
the form element. Check the URL and log the get object in Django to make
sure the data is actually appearing in both.

On Thu, Mar 7, 2019, 13:52 drone4four  wrote:

> Hello!
>
> I’m trying to run a basic Django app which redacts a 16 digit number
> entered by the user. I had a it running a few minutes ago. I’m not sure
> what I changed, but now I am getting a MultiValueDictKeyError. I’ve triple
> checked every variable. The only dictionary in my project is in views.py at
> line 7. As far as I can tell, it’s all accurate and positioned correctly. I
> don’t recall changing this dictionary or any other operator around this
> line. I’m stumped. What would you people suggest? Have a look at my setup.
>
>
> *Here is the error and traceback in full:* https://pastebin.com/QwSrmAJx
>
> Here is my urls.py:
> from django.conf.urls import  include, url
>
>
>
> from django.contrib import admin
>
> from django.urls import path
>
> from . import views
>
>
> urlpatterns = [
>
>url(r'^admin/', admin.site.urls),
>
>url(r'^$', views.home, name='home'),
>
>
>
> views.py:
> from django.http import HttpResponse
>
>
>
> from django.shortcuts import render
>
>
> def home(request):
>
>number = request.GET['ccEntry']
>
>redacted_num = '   {}'.format(number[-4:])
>
>return render(request, 'home.html', {'number':number, 'redacted_num':
> redacted_num})
>
>
>
> home.html template:
> 
>
>
>
>
> 
>
> 
>
>  
>
>Enter your fake Chuckee Cheese Neptune credit card number!
>
>
>
>  
>
>  
>
>  
>
>Must be a 16 digit number.
>
>  
>
>  
>
>
>
>
>
>
>
>
>
>Original Card Number:
>
>
>
>{{ number }}
>
>
>
>Redacted Card Number:
>
>
>
>{{ redacted_num }}
>
>
>
> Did this work?
>
>
>
> 
>
>
>
> --
> 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/49da3086-6f3d-415b-b451-7e4c6a6e542c%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/CAHKA7fAzRPxGX29n374c7X9c-tqCL3MLAdq8F_bD_5_bdgZGhg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django credit card redaction app - - MultiValueDictKeyError

2019-03-07 Thread drone4four


Thanks, Sam for the help.

You wrote:

I would be careful how you pass the data on get, somewhere in your front 
> end code you are probably not passing the data through as you expected. 
> Instead of using .GET, use .GET.get to get your data. This will either 
> return the value you want, or none.


I looked up GET.get Django and found an SO post titled, “Django request.GET 
” which has 
quite a few up votes. Based on that SO answer, In my views.py I changed the 
line (where I declare the number variable) from `number = 
request.GET['ccEntry']` to `number = request.GET.get['ccEntry', None]`  

That gives a different error (a type error this time): 
https://pastebin.com/L81LVtzi 

You also mentioned my front end. I had included the template in my original 
post. I have since refined it so it is more readable. Here is my improved 
home.html template:







  Search 



  





 

   Enter your fake Chuckee Cheese Neptune credit card number!

   

  Must be a 16 digit number. 

   

 



   Original Card Number:

   {{ number }}

   Redacted Card Number:

   {{ redacted_num }}

Did this work?   









Sam, you also suggested:

I think you have made the error of not passing your data to the get header 
> as you didn't explicitly write this on the form element. 


I did explicitly include my data in my form element as you can see in the 
above template.


Check the URL and log the get object in Django to make sure the data is 
> actually appearing in both.


The data is present as “ccEntry” in both home.html and in views.py.




On Thursday, March 7, 2019 at 10:42:25 AM UTC-5, Sam Taiwo wrote:
>
> I would be careful how you pass the data on get, somewhere in your front 
> end code you are probably not passing the data through as you expected. 
> Instead of using .GET, use .GET.get to get your data. This will either 
> return the value you want, or none. I think you have made the error of not 
> passing your data to the get header as you didn't explicitly write this on 
> the form element. Check the URL and log the get object in Django to make 
> sure the data is actually appearing in both.
>
> On Thu, Mar 7, 2019, 13:52 drone4four > 
> wrote:
>
>> Hello!
>>
>> I’m trying to run a basic Django app which redacts a 16 digit number 
>> entered by the user. I had a it running a few minutes ago. I’m not sure 
>> what I changed, but now I am getting a MultiValueDictKeyError. I’ve triple 
>> checked every variable. The only dictionary in my project is in views.py at 
>> line 7. As far as I can tell, it’s all accurate and positioned correctly. I 
>> don’t recall changing this dictionary or any other operator around this 
>> line. I’m stumped. What would you people suggest? Have a look at my setup.
>>
>>
>> *Here is the error and traceback in full:* https://pastebin.com/QwSrmAJx 
>>
>> Here is my urls.py:
>> from django.conf.urls import  include, url
>>
>>
>>
>> from django.contrib import admin
>>
>> from django.urls import path
>>
>> from . import views
>>
>>
>> urlpatterns = [
>>
>>url(r'^admin/', admin.site.urls),
>>
>>url(r'^$', views.home, name='home'),
>>
>>
>>
>> views.py:
>> from django.http import HttpResponse
>>
>>
>>
>> from django.shortcuts import render
>>
>>
>> def home(request):
>>
>>number = request.GET['ccEntry']
>>
>>redacted_num = '   {}'.format(number[-4:])
>>
>>return render(request, 'home.html', {'number':number, 'redacted_num':
>> redacted_num})
>>
>>
>>
>> home.html template:
>> 
>>
>>
>>
>>
>> 
>>
>> 
>>
>>  
>>
>>Enter your fake Chuckee Cheese Neptune credit card number!
>>
>>
>>
>>  
>>
>>  
>>
>>  
>>
>>Must be a 16 digit number.
>>
>>  
>>
>>  
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>Original Card Number:
>>
>>
>>
>>{{ number }}
>>
>>
>>
>>Redacted Card Number:
>>
>>
>>
>>{{ redacted_num }}
>>
>>
>>
>> Did this work?   
>>
>>
>>
>> 
>>
>>
>>
>> -- 
>> 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/49da3086-6f3d-415b-b451-7e4c6a6e542c%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...@googlegro

django.db.utils.OperationalError: no such table: user_user

2019-03-07 Thread cyril moreau
Hi,

I have the following model that i use as AUTH_USER_MODEL :

model.py


class User(AbstractBaseUser, PermissionsMixin):
   email = models.EmailField(_('email address'), unique=True)
   password = models.CharField(_('password'), max_length=255, blank=False)
   first_name = models.CharField(_('first name'), max_length=30, blank=True)
   last_name = models.CharField(_('last name'), max_length=30, blank=True)
   date_joined = models.DateTimeField(_('date joined'), auto_now_add=True)
   is_active = models.BooleanField(_('active'), default=True)
   is_staff = models.BooleanField(_('staff status'), default=False)
   avatar = models.CharField(_('avatar'), max_length=30, blank=True, null=
True) 
#models.ImageField(upload_to='avatars/', null=True, blank=True)

objects = UserManager()

USERNAME_FIELD = 'email'
   REQUIRED_FIELDS = []

class Meta:
   verbose_name = _('user')
   verbose_name_plural = _('users')

settings.py
AUTH_USER_MODEL = 'user.User'


When i want to create a superuser and enter the email of the user i want to 
create :
python manage.py createsuperuser


I get the following error : 
django.db.utils.OperationalError: no such table: user_user

Someone knows why I get this error?

Thank you for you 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/727d62a0-836b-447b-b156-663985a40e6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Django credit card redaction app - - MultiValueDictKeyError

2019-03-07 Thread Matthew Pava
Please just paste the error in the email message. The error message that you 
have mentions a ‘method’ object, which is not present in the code that you have 
sent to us.  That would be where the problem is.



From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of drone4four
Sent: Thursday, March 7, 2019 11:29 AM
To: Django users
Subject: Re: Django credit card redaction app - - MultiValueDictKeyError


Thanks, Sam for the help.


You wrote:

I would be careful how you pass the data on get, somewhere in your front end 
code you are probably not passing the data through as you expected. Instead of 
using .GET, use .GET.get to get your data. This will either return the value 
you want, or none.


I looked up GET.get Django and found an SO post titled, “Django 
request.GET” 
which has quite a few up votes. Based on that SO answer, In my views.py I 
changed the line (where I declare the number variable) from `number = 
request.GET['ccEntry']` to `number = request.GET.get['ccEntry', None]`


That gives a different error (a type error this time): 
https://pastebin.com/L81LVtzi


You also mentioned my front end. I had included the template in my original 
post. I have since refined it so it is more readable. Here is my improved 
home.html template:







  Search 



  





 

   Enter your fake Chuckee Cheese Neptune credit card number!

   

  Must be a 16 digit number. 

   

 



   Original Card Number:

   {{ number }}

   Redacted Card Number:

   {{ redacted_num }}

Did this work?










Sam, you also suggested:

I think you have made the error of not passing your data to the get header as 
you didn't explicitly write this on the form element.


I did explicitly include my data in my form element as you can see in the above 
template.

Check the URL and log the get object in Django to make sure the data is 
actually appearing in both.


The data is present as “ccEntry” in both home.html and in views.py.




On Thursday, March 7, 2019 at 10:42:25 AM UTC-5, Sam Taiwo wrote:
I would be careful how you pass the data on get, somewhere in your front end 
code you are probably not passing the data through as you expected. Instead of 
using .GET, use .GET.get to get your data. This will either return the value 
you want, or none. I think you have made the error of not passing your data to 
the get header as you didn't explicitly write this on the form element. Check 
the URL and log the get object in Django to make sure the data is actually 
appearing in both.

On Thu, Mar 7, 2019, 13:52 drone4four > wrote:

Hello!


I’m trying to run a basic Django app which redacts a 16 digit number entered by 
the user. I had a it running a few minutes ago. I’m not sure what I changed, 
but now I am getting a MultiValueDictKeyError. I’ve triple checked every 
variable. The only dictionary in my project is in views.py at line 7. As far as 
I can tell, it’s all accurate and positioned correctly. I don’t recall changing 
this dictionary or any other operator around this line. I’m stumped. What would 
you people suggest? Have a look at my setup.



Here is the error and traceback in full: https://pastebin.com/QwSrmAJx


Here is my urls.py:
from django.conf.urls import  include, url



from django.contrib import admin

from django.urls import path

from . import views


urlpatterns = [

   url(r'^admin/', admin.site.urls),

   url(r'^$', views.home, name='home'),




views.py:
from django.http import HttpResponse



from django.shortcuts import render


def home(request):

   number = request.GET['ccEntry']

   redacted_num = '   {}'.format(number[-4:])

   return render(request, 'home.html', {'number':number, 
'redacted_num':redacted_num})




home.html template:









 

   Enter your fake Chuckee Cheese Neptune credit card number!

   

 

 

 

   Must be a 16 digit number.

 

 

   

   

   

   

   Original Card Number:

   

   {{ number }}

   

   Redacted Card Number:

   

   {{ redacted_num }}

   

Did this work?

   





--
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/49da3086-6f3d-415b-b451-7e4c6a6e542c%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 e

Re: Django credit card redaction app - - MultiValueDictKeyError

2019-03-07 Thread drone4four
Here is the error, traceback and Request information:

MultiValueDictKeyError at /

'ccEntry'

Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 2.0.2
Exception Type: MultiValueDictKeyError
Exception Value: 

'ccEntry'

Exception Location: 
/home//.local/lib/python3.7/site-packages/django/utils/datastructures.py 
in __getitem__, line 79
Python Executable: /usr/sbin/python
Python Version: 3.7.2
Python Path: 

['/home//dev/projects/python/2018-and-2019/cel2fah-original_with_CC-redact-project-_Django202/first_project_attempt',
 '/usr/lib/python37.zip',
 '/usr/lib/python3.7',
 '/usr/lib/python3.7/lib-dynload',
 '/home//.local/lib/python3.7/site-packages',
 '/usr/lib/python3.7/site-packages',
 '/usr/lib/python3.7/site-packages/setuptools-40.6.2-py3.7.egg']

Server time:



Thu, 7 Mar 2019 17:39:40 +


Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/

Django Version: 2.0.2
Python Version: 3.7.2
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback:

File 
"/home//.local/lib/python3.7/site-packages/django/utils/datastructures.py"
 
in __getitem__
  77. list_ = super().__getitem__(key)

During handling of the above exception ('ccEntry'), another exception 
occurred:

File 
"/home//.local/lib/python3.7/site-packages/django/core/handlers/exception.py"
 
in inner
  35. response = get_response(request)

File 
"/home//.local/lib/python3.7/site-packages/django/core/handlers/base.py" 
in _get_response
  128. response = self.process_exception_by_middleware(e, 
request)

File 
"/home//.local/lib/python3.7/site-packages/django/core/handlers/base.py" 
in _get_response
  126. response = wrapped_callback(request, *callback_args, 
**callback_kwargs)

File 
"/home//dev/projects/python/2018-and-2019/cel2fah-original_with_CC-redact-project-_Django202/first_project_attempt/first_project_attempt/views.py"
 
in home
  5. number = request.GET['ccEntry']

File 
"/home//.local/lib/python3.7/site-packages/django/utils/datastructures.py"
 
in __getitem__
  79. raise MultiValueDictKeyError(key)

Exception Type: MultiValueDictKeyError at /
Exception Value: 'ccEntry'

Request informationUSER

AnonymousUser
GET

No GET data
POST

No POST data
FILES
No FILES data

On Thursday, March 7, 2019 at 1:34:17 PM UTC-5, Matthew Pava wrote:
>
> Please just paste the error in the email message. The error message that 
> you have mentions a ‘method’ object, which is not present in the code that 
> you have sent to us.  That would be where the problem is.
>
>  
>
>  
>
>  
>
> *From:* django...@googlegroups.com  [mailto:
> django...@googlegroups.com ] *On Behalf Of *drone4four
> *Sent:* Thursday, March 7, 2019 11:29 AM
> *To:* Django users
> *Subject:* Re: Django credit card redaction app - - MultiValueDictKeyError
>
>  
>
> Thanks, Sam for the help.
>
>  
>
> You wrote:
>
>  
>
> I would be careful how you pass the data on get, somewhere in your front 
> end code you are probably not passing the data through as you expected. 
> Instead of using .GET, use .GET.get to get your data. This will either 
> return the value you want, or none.
>
>  
>
> I looked up GET.get Django and found an SO post titled, “Django 
> request.GET 
> ” which 
> has quite a few up votes. Based on that SO answer, In my views.py I changed 
> the line (where I declare the number variable) from `number = 
> request.GET['ccEntry']` to `number = request.GET.get['ccEntry', None]`  
>
>  
>
> That gives a different error (a type error this time): 
> https://pastebin.com/L81LVtzi 
>
>  
>
> You also mentioned my front end. I had included the template in my 
> original post. I have since refined it so it is more readable. Here is my 
> improved home.html template:
>
>  
>
> 
>
>
>
> 
>
>   Search 
>
> 
>
>   
>
> 
>
> 
>
>  
>
>Enter your fake Chuckee Cheese Neptune credit card number!
>
>
>
>   Must be a 16 digit number. 
>
>
>
>  
>
> 
>
>Original Card Number:
>
>{{ number }}
>
>Redacted Card Number:
>
>{{ redacted_num }}
>
> Did this work?   
>
> 
>
> 
>
> 
>
>  
>
>  
>
> Sam, you also suggested:
>
>  
>
> I think you have made the error of not passing your data to the get header 
> as you didn't explicitly write this on the form element. 
>
>  
>
> I did explicitly include my data in my form element as you can see in the 
> above te

Re: Django credit card redaction app - - MultiValueDictKeyError

2019-03-07 Thread Deepak Chhitarka
In your home.html template, you forgot to write method="get" . Which I
think is causing the problem here.

On Fri 8 Mar, 2019, 12:03 AM Matthew Pava,  wrote:

> Please just paste the error in the email message. The error message that
> you have mentions a ‘method’ object, which is not present in the code that
> you have sent to us.  That would be where the problem is.
>
>
>
>
>
>
>
> *From:* django-users@googlegroups.com [mailto:
> django-users@googlegroups.com] *On Behalf Of *drone4four
> *Sent:* Thursday, March 7, 2019 11:29 AM
> *To:* Django users
> *Subject:* Re: Django credit card redaction app - - MultiValueDictKeyError
>
>
>
> Thanks, Sam for the help.
>
>
>
> You wrote:
>
>
>
> I would be careful how you pass the data on get, somewhere in your front
> end code you are probably not passing the data through as you expected.
> Instead of using .GET, use .GET.get to get your data. This will either
> return the value you want, or none.
>
>
>
> I looked up GET.get Django and found an SO post titled, “Django
> request.GET
> ” which
> has quite a few up votes. Based on that SO answer, In my views.py I changed
> the line (where I declare the number variable) from `number =
> request.GET['ccEntry']` to `number = request.GET.get['ccEntry', None]`
>
>
>
> That gives a different error (a type error this time):
> https://pastebin.com/L81LVtzi
>
>
>
> You also mentioned my front end. I had included the template in my
> original post. I have since refined it so it is more readable. Here is my
> improved home.html template:
>
>
>
> 
>
>
>
> 
>
>   Search 
>
> 
>
>   
>
> 
>
> 
>
>  
>
>Enter your fake Chuckee Cheese Neptune credit card number!
>
>
>
>   Must be a 16 digit number. 
>
>
>
>  
>
> 
>
>Original Card Number:
>
>{{ number }}
>
>Redacted Card Number:
>
>{{ redacted_num }}
>
> Did this work?
>
> 
>
> 
>
> 
>
>
>
>
>
> Sam, you also suggested:
>
>
>
> I think you have made the error of not passing your data to the get header
> as you didn't explicitly write this on the form element.
>
>
>
> I did explicitly include my data in my form element as you can see in the
> above template.
>
>
>
> Check the URL and log the get object in Django to make sure the data is
> actually appearing in both.
>
>
>
> The data is present as “ccEntry” in both home.html and in views.py.
>
>
>
>
>
>
> On Thursday, March 7, 2019 at 10:42:25 AM UTC-5, Sam Taiwo wrote:
>
> I would be careful how you pass the data on get, somewhere in your front
> end code you are probably not passing the data through as you expected.
> Instead of using .GET, use .GET.get to get your data. This will either
> return the value you want, or none. I think you have made the error of not
> passing your data to the get header as you didn't explicitly write this on
> the form element. Check the URL and log the get object in Django to make
> sure the data is actually appearing in both.
>
>
>
> On Thu, Mar 7, 2019, 13:52 drone4four  wrote:
>
> Hello!
>
>
>
> I’m trying to run a basic Django app which redacts a 16 digit number
> entered by the user. I had a it running a few minutes ago. I’m not sure
> what I changed, but now I am getting a MultiValueDictKeyError. I’ve triple
> checked every variable. The only dictionary in my project is in views.py at
> line 7. As far as I can tell, it’s all accurate and positioned correctly. I
> don’t recall changing this dictionary or any other operator around this
> line. I’m stumped. What would you people suggest? Have a look at my setup.
>
>
>
> *Here is the error and traceback in full:* https://pastebin.com/QwSrmAJx
>
>
>
> *Here is my urls.py:*
>
> from django.conf.urls import  include, url
>
>
>
> from django.contrib import admin
>
> from django.urls import path
>
> from . import views
>
>
> urlpatterns = [
>
>url(r'^admin/', admin.site.urls),
>
>url(r'^$', views.home, name='home'),
>
>
>
>
>
> *views.py:*
>
> from django.http import HttpResponse
>
>
>
> from django.shortcuts import render
>
>
> def home(request):
>
>number = request.GET['ccEntry']
>
>redacted_num = '   {}'.format(number[-4:])
>
>return render(request, 'home.html', {'number':number, 'redacted_num':
> redacted_num})
>
>
>
>
>
> *home.html template:*
>
> 
>
>
>
>
> 
>
> 
>
>  
>
>Enter your fake Chuckee Cheese Neptune credit card number!
>
>
>
>  
>
>  
>
>  
>
>Must be a 16 digit number.
>
>  
>
>  
>
>
>
>
>
>
>
>
>
>Original Card Number:
>
>
>
>{{ number }}
>
>
>
>Redacted Card Number:
>
>
>
>{{ redacted_num }}
>
>
>
> Did this work?
>
>
>
> 
>
>
>
>
>
> --
> 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...@

Re: django.db.utils.OperationalError: no such table: user_user

2019-03-07 Thread cyril moreau
To fix my issue I had to makemigrations for each one of my app :

by doing the following it will create my user table :

python manage.py  makemigrations user

does not work if i just do :
python manage.py  makemigrations


Best regards

Le jeudi 7 mars 2019 19:01:10 UTC+1, cyril moreau a écrit :
>
> Hi,
>
> I have the following model that i use as AUTH_USER_MODEL :
>
> model.py
>
>
> class User(AbstractBaseUser, PermissionsMixin):
>email = models.EmailField(_('email address'), unique=True)
>password = models.CharField(_('password'), max_length=255, blank=False)
>first_name = models.CharField(_('first name'), max_length=30, blank=
> True)
>last_name = models.CharField(_('last name'), max_length=30, blank=True)
>date_joined = models.DateTimeField(_('date joined'), auto_now_add=True)
>is_active = models.BooleanField(_('active'), default=True)
>is_staff = models.BooleanField(_('staff status'), default=False)
>avatar = models.CharField(_('avatar'), max_length=30, blank=True, null=
> True) 
> #models.ImageField(upload_to='avatars/', null=True, blank=True)
>
> objects = UserManager()
>
> USERNAME_FIELD = 'email'
>REQUIRED_FIELDS = []
>
> class Meta:
>verbose_name = _('user')
>verbose_name_plural = _('users')
>
> settings.py
> AUTH_USER_MODEL = 'user.User'
>
>
> When i want to create a superuser and enter the email of the user i want 
> to create :
> python manage.py createsuperuser
>
>
> I get the following error : 
> django.db.utils.OperationalError: no such table: user_user
>
> Someone knows why I get this error?
>
> Thank you for you 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/cfca6c60-4626-470c-afa3-5213862e4dfb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django credit card redaction app - - MultiValueDictKeyError

2019-03-07 Thread drone4four


I am taking a course on Udemy and the instructor doesn’t include a method 
attribute in the form tag.  But as you suggested, Deepak, I went ahead and 
added method="get" to my form tag in my home.html template. So line 7 now 
reads: 

I am still encountering the MultiValueDictKeyError. 

Here is the traceback again:

MultiValueDictKeyError at /

'ccEntry'

Request Method: GET

Request URL: http://127.0.0.1:8000/

Django Version: 2.0.2

Exception Type: MultiValueDictKeyError

Exception Value: 

'ccEntry'

Exception Location: 
/home//.local/lib/python3.7/site-packages/django/utils/datastructures.py 
in __getitem__, line 79

Python Executable: /usr/sbin/python

Python Version: 3.7.2

Python Path: 

['/home//dev/projects/python/2018-and-2019/cel2fah-original_with_CC-redact-project-_Django202/first_project_attempt',

'/usr/lib/python37.zip',

'/usr/lib/python3.7',

'/usr/lib/python3.7/lib-dynload',

'/home//.local/lib/python3.7/site-packages',

'/usr/lib/python3.7/site-packages',

'/usr/lib/python3.7/site-packages/setuptools-40.6.2-py3.7.egg']

Server time: Thu, 7 Mar 2019 20:11:44 +

Environment:


Request Method: GET

Request URL: http://127.0.0.1:8000/

Django Version: 2.0.2

Python Version: 3.7.2

Installed Applications:

['django.contrib.admin',

'django.contrib.auth',

'django.contrib.contenttypes',

'django.contrib.sessions',

'django.contrib.messages',

'django.contrib.staticfiles']

Installed Middleware:

['django.middleware.security.SecurityMiddleware',

'django.contrib.sessions.middleware.SessionMiddleware',

'django.middleware.common.CommonMiddleware',

'django.middleware.csrf.CsrfViewMiddleware',

'django.contrib.auth.middleware.AuthenticationMiddleware',

'django.contrib.messages.middleware.MessageMiddleware',

'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback:

File 
"/home//.local/lib/python3.7/site-packages/django/utils/datastructures.py"
 
in __getitem__

 77. list_ = super().__getitem__(key)

During handling of the above exception ('ccEntry'), another exception 
occurred:

File 
"/home//.local/lib/python3.7/site-packages/django/core/handlers/exception.py"
 
in inner

 35. response = get_response(request)

File 
"/home//.local/lib/python3.7/site-packages/django/core/handlers/base.py" 
in _get_response

 128. response = self.process_exception_by_middleware(e, 
request)

File 
"/home//.local/lib/python3.7/site-packages/django/core/handlers/base.py" 
in _get_response

 126. response = wrapped_callback(request, *callback_args, 
**callback_kwargs)

File 
"/home//dev/projects/python/2018-and-2019/cel2fah-original_with_CC-redact-project-_Django202/first_project_attempt/first_project_attempt/views.py"
 
in home

 5. number = request.GET['ccEntry']

File 
"/home//.local/lib/python3.7/site-packages/django/utils/datastructures.py"
 
in __getitem__

 79. raise MultiValueDictKeyError(key)

Exception Type: MultiValueDictKeyError at /

Exception Value: 'ccEntry'


Request information

USER

AnonymousUser

GET

No GET data

POST

No POST data

FILES

No FILES data


On Thursday, March 7, 2019 at 2:50:00 PM UTC-5, Deepak Chhitarka wrote:
>
> In your home.html template, you forgot to write method="get" . Which I 
> think is causing the problem here.
>
> On Fri 8 Mar, 2019, 12:03 AM Matthew Pava,  > wrote:
>
>> Please just paste the error in the email message. The error message that 
>> you have mentions a ‘method’ object, which is not present in the code that 
>> you have sent to us.  That would be where the problem is.
>>
>>  
>>
>>  
>>
>>  
>>
>> *From:* django...@googlegroups.com  [mailto:
>> django...@googlegroups.com ] *On Behalf Of *drone4four
>> *Sent:* Thursday, March 7, 2019 11:29 AM
>> *To:* Django users
>> *Subject:* Re: Django credit card redaction app - - 
>> MultiValueDictKeyError
>>
>>  
>>
>> Thanks, Sam for the help.
>>
>>  
>>
>> You wrote:
>>
>>  
>>
>> I would be careful how you pass the data on get, somewhere in your front 
>> end code you are probably not passing the data through as you expected. 
>> Instead of using .GET, use .GET.get to get your data. This will either 
>> return the value you want, or none.
>>
>>  
>>
>> I looked up GET.get Django and found an SO post titled, “Django 
>> request.GET 
>> ” which 
>> has quite a few up votes. Based on that SO answer, In my views.py I changed 
>> the line (where I declare the number variable) from `number = 
>> request.GET['ccEntry']` to `number = request.GET.get['ccEntry', None]`  
>>
>>  
>>
>> That gives a different error (a type error this time): 
>> https://pastebin.com/L81LVtzi 
>>
>>  
>>
>> You also mentioned my front end. I had included the template in my 
>> original post. I have since refined it so it is more readable. Here is my 
>> improved home.html template:
>>
>>  
>>
>> 
>>
>>
>>
>> 
>>
>>   Search 
>>
>> 
>>
>>   
>>
>> 
>>
>> 
>>
>>  
>>
>>Enter your fake C

Re: Django credit card redaction app - - MultiValueDictKeyError

2019-03-07 Thread drone4four


This is a long shot, but I thought I would share a link to my source code 
hosted on GitHub with a requirements.txt included. If any of you would like 
to test this out yourself, I am accepting pull requests. Here it is: 
https://github.com/Angeles4four/CC_Redact


On Thursday, March 7, 2019 at 4:03:37 PM UTC-5, drone4four wrote:
>
> I am taking a course on Udemy and the instructor doesn’t include a method 
> attribute in the form tag.  But as you suggested, Deepak, I went ahead and 
> added method="get" to my form tag in my home.html template. So line 7 now 
> reads: 
>
> I am still encountering the MultiValueDictKeyError. 
>
> Here is the traceback again:
>
> MultiValueDictKeyError at /
>
> 'ccEntry'
>
> Request Method: GET
>
> Request URL: http://127.0.0.1:8000/
>
> Django Version: 2.0.2
>
> Exception Type: MultiValueDictKeyError
>
> Exception Value: 
>
> 'ccEntry'
>
> Exception Location: 
> /home//.local/lib/python3.7/site-packages/django/utils/datastructures.py
>  
> in __getitem__, line 79
>
> Python Executable: /usr/sbin/python
>
> Python Version: 3.7.2
>
> Python Path: 
>
>
> ['/home//dev/projects/python/2018-and-2019/cel2fah-original_with_CC-redact-project-_Django202/first_project_attempt',
>
> '/usr/lib/python37.zip',
>
> '/usr/lib/python3.7',
>
> '/usr/lib/python3.7/lib-dynload',
>
> '/home//.local/lib/python3.7/site-packages',
>
> '/usr/lib/python3.7/site-packages',
>
> '/usr/lib/python3.7/site-packages/setuptools-40.6.2-py3.7.egg']
>
> Server time: Thu, 7 Mar 2019 20:11:44 +
>
> Environment:
>
>
> Request Method: GET
>
> Request URL: http://127.0.0.1:8000/
>
> Django Version: 2.0.2
>
> Python Version: 3.7.2
>
> Installed Applications:
>
> ['django.contrib.admin',
>
> 'django.contrib.auth',
>
> 'django.contrib.contenttypes',
>
> 'django.contrib.sessions',
>
> 'django.contrib.messages',
>
> 'django.contrib.staticfiles']
>
> Installed Middleware:
>
> ['django.middleware.security.SecurityMiddleware',
>
> 'django.contrib.sessions.middleware.SessionMiddleware',
>
> 'django.middleware.common.CommonMiddleware',
>
> 'django.middleware.csrf.CsrfViewMiddleware',
>
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
>
> 'django.contrib.messages.middleware.MessageMiddleware',
>
> 'django.middleware.clickjacking.XFrameOptionsMiddleware']
>
>
>
> Traceback:
>
> File 
> "/home//.local/lib/python3.7/site-packages/django/utils/datastructures.py"
>  
> in __getitem__
>
>  77. list_ = super().__getitem__(key)
>
> During handling of the above exception ('ccEntry'), another exception 
> occurred:
>
> File 
> "/home//.local/lib/python3.7/site-packages/django/core/handlers/exception.py"
>  
> in inner
>
>  35. response = get_response(request)
>
> File 
> "/home//.local/lib/python3.7/site-packages/django/core/handlers/base.py"
>  
> in _get_response
>
>  128. response = self.process_exception_by_middleware(e, 
> request)
>
> File 
> "/home//.local/lib/python3.7/site-packages/django/core/handlers/base.py"
>  
> in _get_response
>
>  126. response = wrapped_callback(request, *callback_args, 
> **callback_kwargs)
>
> File 
> "/home//dev/projects/python/2018-and-2019/cel2fah-original_with_CC-redact-project-_Django202/first_project_attempt/first_project_attempt/views.py"
>  
> in home
>
>  5. number = request.GET['ccEntry']
>
> File 
> "/home//.local/lib/python3.7/site-packages/django/utils/datastructures.py"
>  
> in __getitem__
>
>  79. raise MultiValueDictKeyError(key)
>
> Exception Type: MultiValueDictKeyError at /
>
> Exception Value: 'ccEntry'
>
>
> Request information
>
> USER
>
> AnonymousUser
>
> GET
>
> No GET data
>
> POST
>
> No POST data
>
> FILES
>
> No FILES data
>
>
> On Thursday, March 7, 2019 at 2:50:00 PM UTC-5, Deepak Chhitarka wrote:
>>
>> In your home.html template, you forgot to write method="get" . Which I 
>> think is causing the problem here.
>>
>> On Fri 8 Mar, 2019, 12:03 AM Matthew Pava,  wrote:
>>
>>> Please just paste the error in the email message. The error message that 
>>> you have mentions a ‘method’ object, which is not present in the code that 
>>> you have sent to us.  That would be where the problem is.
>>>
>>>  
>>>
>>>  
>>>
>>>  
>>>
>>> *From:* django...@googlegroups.com [mailto:django...@googlegroups.com] *On 
>>> Behalf Of *drone4four
>>> *Sent:* Thursday, March 7, 2019 11:29 AM
>>> *To:* Django users
>>> *Subject:* Re: Django credit card redaction app - - 
>>> MultiValueDictKeyError
>>>
>>>  
>>>
>>> Thanks, Sam for the help.
>>>
>>>  
>>>
>>> You wrote:
>>>
>>>  
>>>
>>> I would be careful how you pass the data on get, somewhere in your front 
>>> end code you are probably not passing the data through as you expected. 
>>> Instead of using .GET, use .GET.get to get your data. This will either 
>>> return the value you want, or none.
>>>
>>>  
>>>
>>> I looked up GET.get Django and found an SO post titled, “Django 
>>> request.GET 
>>> 

Most likely an elementary fix

2019-03-07 Thread Joseph Jones
Good afternoon all!
I have been reading
https://www.packtpub.com/application-development/learn-python-programming-second-edition
since
November so I am very much new to the Python Community. I am currently on
Ch. 14 "Web Development" which indicates to complete the tutorial on
djangoproject.com after installing Django of course. when I've run the />
py -m django --version command in the cmd of my PC I receive a
ModuleNotFoundError. which the text in the tutorial states is an indication
that I did not install Django.  If I rerun /> pip install Django==2.1.7
however I receive "requirement is already satisfied Django==2.1.7" So it
would appear django is installed but my shell does not recognize it. I
hypothesize that I either:  did not configure my virtual environment
properly, or am pulling up the wrong folder in my cmd. Any advice on how To
fix this most likely Elementary mistake would be immensely appreciated. Let
me apologize in advance if I either ask for clarification in terminology of
any responses(again I am new) or mess up  again through out the course of
the tutorial and reach out to the community. Thank you!
Joseph

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


Re: migrating from 2.7 to 3.x on Ubuntu

2019-03-07 Thread Mike Dewhirst

On 8/03/2019 12:34 am, Ryan Nowakowski wrote:
Seems doable. I would leave nginx out of it and just run gunicorn 
Python 3 with Apache. Also I would do the release upgrade before.


Thanks Ryan - that makes a lot of sense to me. Should simplify the 
process and give me confidence to start sooner rather than later.


:)

Mike



On March 4, 2019 10:40:21 PM CST, Mike Dewhirst 
 wrote:


On the same host, is it viable to switch my Django projects away from
vhosts under Apache2/mod_wsgi/py2.7 to Gunicorn and Nginx running with
Python 3.x ...

AND SIMULTANEOUSLY

... leave Trac running on Apache2 mod_wsgi/py2.7?

Trac is not yet released for Python 3.x. There is also a Subversion
server running via Apache2 so it looks like I need to keep Apache2
anyway.  I also have Buildbot running under Python 2.7 on that machine
but it runs on Twisted so I expect that will be a regular migration.

As a bonus question,  if this is even possible, would you
do-release-upgrade Ubuntu 16.04 to 18.04 before or after such a migration.

Thanks for any sympathy as well as advice.

--
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/13C53DB6-22AB-419D-B11E-3B606B9C3B68%40fattuba.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/661afb0d-37f4-91ff-3bea-402cdce2543d%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: How does WSGI work?

2019-03-07 Thread Tal
The word "simple" appears 13 times in PEP, but no one knows how this 
magical specification works?
Can anyone confirm I'm not crazy please?

On Tuesday, February 26, 2019 at 3:13:00 PM UTC-7, Tal wrote:
>
> Is it right though?
>
> On Tuesday, February 26, 2019 at 2:49:03 PM UTC-7, mike wrote:
>>
>> Great write up!
>>
>> On Tue, Feb 26, 2019 at 2:39 PM Tal  wrote:
>>
>>> Did I get something wrong?
>>> Do you mean the devs working on the Django project know nothing about 
>>> this, or the devs using Django to build web apps?
>>> From what I've read, devs using Django don't need to be too familiar 
>>> with WSGI, but it seems like it helps at least having a conceptual 
>>> understanding of what it is.
>>>
>>> On Tuesday, February 26, 2019 at 12:28:26 PM UTC-7, Motaz Hejaze wrote:

 You are very close to what realy happens , most of devs know nothing 
 aboutbthis stuff

 On Tue, 26 Feb 2019, 20:26 Tal,  wrote:

> I've been developing web applications using Flask and Django for about 
> a year now, and although I've come across the term WSGI a bunch of times 
> in 
> both frameworks, I never really understood what it did. I'm sure I'm not 
> the only one. The quick explanations I read never made sense to me. Even 
> PEP didn't really give me a clear picture of how WSGI fits in with 
> Nginx, and Django. There are a bunch of articles online that quickly show 
> how to setup nginx, gunicorn/uwsgi and django to work in production, and 
> once I figured that out, I never really had a reason to figure out WSGI 
> again. But it's been a year now, and I probably should understand at 
> least 
> the basics. 
>
> I did a bit more reading recently, and I think I get it. Just looking 
> for someone to confirm that I'm on the right track.
> This is how I think it works:
>
> My example uses the most common setup I use: Nginx, Gunicorn and Django
>
>- When an HTTP request comes in, it hits Nginx first
>   - Nginx runs multiple processes, and makes sure that 
>   browsers/clients that have a slow connection don't effect other 
> clients
>   - If it's a request for a static file, like a CSS file, JS, 
>   image, or anything like that, Nginx returns it directly
>   - If it's a request for anything else, it uses *HTTP* to send 
>   the request over a Unix socket to Gunicorn
>  - Doesn't have to be a Unix socket, but if both Nginx and 
>  Gunicorn are running on the same host, it makes sense to use 
> Unix sockets
>  - The main point is that Nginx uses HTTP to communicate with 
>  Gunicorn
>   - Gunicorn
>   - Starts up x worker processes on startup (as many as you tell 
>   it)
>   - Each worker process imports your application's code 
>   (django.core.wsgi.get_wsgi_application() in Django's case)
>  - The application's code is a callable function
>  - Gunicorn imports it so that it's ready to make a function 
>  call to it as soon as an HTTP request comes in
>   - When an HTTP request comes in from Nginx, Gunicorn will:
>  - Use its main process to assign the request to a free 
>  worker process
>  - The worker process translates the HTTP headers into a 
>  python dictionary (commonly called the 'environment' dictionary)
>  - The worker process makes a function call to your 
>  application, passing it the 'environment' dictionary, and a 
> start_response 
>  function
>   - When your application (Django) decides what to do about the 
>request, and decides to formulate a response, it will:
>   - Call start_response, giving it the HTTP response status (eg. 
>   200 OK), and the HTTP response headers as a Python object (list of 
> tuples)
>   - Note: At this point, nothing is sent to the client's browser, 
>  or even Nginx yet
>   - *Return* the body of the response as an iterable
>- Gunicorn will then:
>   - Add any required HTTP headers the application didn't provide
>   - Turn the status, headers and body that it received from the 
>   application into an HTTP response message
>   - Send the response back to Nginx using HTTP
>- Nginx will then send the response back to the client
>
>
> So the job of the individual parts is basically this:
>
>1. Nginx
>   - Buffers slow clients
>   - Quickly serves static files
>   - Possibly handle SSL, if configured
>   - Passes HTTP requests to Gunicorn (also using HTTP)
>   2. Gunicorn
>   - Deals with TCP connections between nginx and itself
>  - Prevents your application from needing to do lower-level 
>  

Re: Is there a package for user-tagging and user-properties?

2019-03-07 Thread Charles Thayer
Thanks Simon,

I'm thinking of something more ad-hoc where key-value pairs can be attached 
to users, and the values might be simple strings, ints, datetime or other 
types.
I've started with just simple tags using django-taggit, but I'm still 
keeping my eyes open.

/charles
PS. $ pip search taggit:

taggit-selectize (2.6.0) - django-taggit + 
selectize.js




ella-taggit (1.0.8)  - django-taggit wrapper for 
Ella CMS



  
django-taggit (0.24.0)   - django-taggit is a reusable 
Django application for simple tagging.  




django-taggit-templatetags (0.2.5)   - Templatetags for 
django-taggit.  



   
django-taggit-autocomplete (0.1) - Autocompletion for 
django-taggit  



  
django-taggit-anywhere (0.1.2)   - django-taggit with easy  




   
django-taggit-autosuggest (0.3.4)- Autosuggestions for 
django-taggit  



 
django-taggit-templatetags2 (1.6.1)  - Templatetags for 
django-taggit.  



   
django-taggit-labels (0.6.0) - Alternate labels for 
django-taggit  




django-taggit-forms (0.1.1)  - Tag-creation forms for 
django-taggit  



  
django-taggit-live (0.0.7)   - It's an autocomplete widget 
for django-taggit TagField  




django-taggit-machinetags (0.7.1)- Machine tagging built upon 
django-taggit  



  
django-taggit-serializer (0.

Re: How does WSGI work?

2019-03-07 Thread Mike Dewhirst

On 8/03/2019 10:11 am, Tal wrote:
The word "simple" appears 13 times in PEP, but no one knows how 
this magical specification works?

Can anyone confirm I'm not crazy please?


You could try writing to Grahame Dumpleton for confirmation. I'm 
reasonably sure he wrote mod_wsgi and ought to be able to correct you if 
you've misunderstood anything.He used to give presentations on wsgi at 
PyCons so you might be able to find something on YouTube from a few 
years ago.


Last I heard of him he is fairly focused on Kubernetes so he probably 
doesn't monitor the Django list any more.




On Tuesday, February 26, 2019 at 3:13:00 PM UTC-7, Tal wrote:

Is it right though?

On Tuesday, February 26, 2019 at 2:49:03 PM UTC-7, mike wrote:

Great write up!

On Tue, Feb 26, 2019 at 2:39 PM Tal  wrote:

Did I get something wrong?
Do you mean the devs working on the Django project know
nothing about this, or the devs using Django to build web
apps?
From what I've read, devs using Django don't need to be
too familiar with WSGI, but it seems like it helps at
least having a conceptual understanding of what it is.

On Tuesday, February 26, 2019 at 12:28:26 PM UTC-7, Motaz
Hejaze wrote:

You are very close to what realy happens , most of
devs know nothing aboutbthis stuff

On Tue, 26 Feb 2019, 20:26 Tal,  wrote:

I've been developing web applications using Flask
and Django for about a year now, and although I've
come across the term WSGI a bunch of times in both
frameworks, I never really understood what it did.
I'm sure I'm not the only one. The quick
explanations I read never made sense to me. Even
PEP didn't really give me a clear picture of
how WSGI fits in with Nginx, and Django. There are
a bunch of articles online that quickly show how
to setup nginx, gunicorn/uwsgi and django to work
in production, and once I figured that out, I
never really had a reason to figure out WSGI
again. But it's been a year now, and I probably
should understand at least the basics.

I did a bit more reading recently, and I think I
get it. Just looking for someone to confirm that
I'm on the right track.
This is how I think it works:

My example uses the most common setup I use:
Nginx, Gunicorn and Django

  * When an HTTP request comes in, it hits Nginx first
  o Nginx runs multiple processes, and makes
sure that browsers/clients that have a
slow connection don't effect other clients
  o If it's a request for a static file, like
a CSS file, JS, image, or anything like
that, Nginx returns it directly
  o If it's a request for anything else, it
uses *HTTP* to send the request over a
Unix socket to Gunicorn
  + Doesn't have to be a Unix socket, but
if both Nginx and Gunicorn are running
on the same host, it makes sense to
use Unix sockets
  + The main point is that Nginx uses HTTP
to communicate with Gunicorn
  * Gunicorn
  o Starts up x worker processes on startup
(as many as you tell it)
  o Each worker process imports your
application's code
(django.core.wsgi.get_wsgi_application()
in Django's case)
  + The application's code is a callable
function
  + Gunicorn imports it so that it's ready
to make a function call to it as soon
as an HTTP request comes in
  o When an HTTP request comes in from Nginx,
Gunicorn will:
  + Use its main process to assign the
request to a free worker process
  + The worker process translates the HTTP
headers into a python dictionary
(commonly called the 'environment'

Re: How does WSGI work?

2019-03-07 Thread Joel Mathew
There's a mod_wsgi_express thread that Graham monitors, so he's sure to get
feedback from there

Understanding this better could help me solve static file blues. Most of
the time I don't understand why my static files fine aren't served when I
move to production.

On Fri, 8 Mar, 2019, 5:29 AM Mike Dewhirst,  wrote:

> On 8/03/2019 10:11 am, Tal wrote:
> > The word "simple" appears 13 times in PEP, but no one knows how
> > this magical specification works?
> > Can anyone confirm I'm not crazy please?
>
> You could try writing to Grahame Dumpleton for confirmation. I'm
> reasonably sure he wrote mod_wsgi and ought to be able to correct you if
> you've misunderstood anything.He used to give presentations on wsgi at
> PyCons so you might be able to find something on YouTube from a few
> years ago.
>
> Last I heard of him he is fairly focused on Kubernetes so he probably
> doesn't monitor the Django list any more.
>
> >
> > On Tuesday, February 26, 2019 at 3:13:00 PM UTC-7, Tal wrote:
> >
> > Is it right though?
> >
> > On Tuesday, February 26, 2019 at 2:49:03 PM UTC-7, mike wrote:
> >
> > Great write up!
> >
> > On Tue, Feb 26, 2019 at 2:39 PM Tal  wrote:
> >
> > Did I get something wrong?
> > Do you mean the devs working on the Django project know
> > nothing about this, or the devs using Django to build web
> > apps?
> > From what I've read, devs using Django don't need to be
> > too familiar with WSGI, but it seems like it helps at
> > least having a conceptual understanding of what it is.
> >
> > On Tuesday, February 26, 2019 at 12:28:26 PM UTC-7, Motaz
> > Hejaze wrote:
> >
> > You are very close to what realy happens , most of
> > devs know nothing aboutbthis stuff
> >
> > On Tue, 26 Feb 2019, 20:26 Tal, 
> wrote:
> >
> > I've been developing web applications using Flask
> > and Django for about a year now, and although I've
> > come across the term WSGI a bunch of times in both
> > frameworks, I never really understood what it did.
> > I'm sure I'm not the only one. The quick
> > explanations I read never made sense to me. Even
> > PEP didn't really give me a clear picture of
> > how WSGI fits in with Nginx, and Django. There are
> > a bunch of articles online that quickly show how
> > to setup nginx, gunicorn/uwsgi and django to work
> > in production, and once I figured that out, I
> > never really had a reason to figure out WSGI
> > again. But it's been a year now, and I probably
> > should understand at least the basics.
> >
> > I did a bit more reading recently, and I think I
> > get it. Just looking for someone to confirm that
> > I'm on the right track.
> > This is how I think it works:
> >
> > My example uses the most common setup I use:
> > Nginx, Gunicorn and Django
> >
> >   * When an HTTP request comes in, it hits Nginx
> first
> >   o Nginx runs multiple processes, and makes
> > sure that browsers/clients that have a
> > slow connection don't effect other clients
> >   o If it's a request for a static file, like
> > a CSS file, JS, image, or anything like
> > that, Nginx returns it directly
> >   o If it's a request for anything else, it
> > uses *HTTP* to send the request over a
> > Unix socket to Gunicorn
> >   + Doesn't have to be a Unix socket, but
> > if both Nginx and Gunicorn are running
> > on the same host, it makes sense to
> > use Unix sockets
> >   + The main point is that Nginx uses HTTP
> > to communicate with Gunicorn
> >   * Gunicorn
> >   o Starts up x worker processes on startup
> > (as many as you tell it)
> >   o Each worker process imports your
> > application's code
> > (django.core.wsgi.get_wsgi_application()
> > in Django's case)
> >   + The application's code is a callable
> > function
> >  

Static files in production [Was: How does WSGI work?]

2019-03-07 Thread Mike Dewhirst

On 8/03/2019 11:54 am, Joel Mathew wrote:
There's a mod_wsgi_express thread that Graham monitors, so he's sure 
to get feedback from there


Understanding this better could help me solve static file blues. Most 
of the time I don't understand why my static files fine aren't served 
when I move to production.


Usually it is because they are in the wrong place.

Your production webserver (in my case Apache) probably wants to serve 
the static files directly without Django getting involved at all. There 
should be an alias directive in your webserver conf which specifies the 
actual location of your static files base directory and equates that 
with the STATIC_URL value in your settings. Similarly for the MEDIA_URL 
value.


All you really need to do is write a script to copy your static files 
from where they live in your dev environment to the location specified 
by STATIC_URL in your production environment.


Alternatively, manage.py collectstatic will do that for you.



On Fri, 8 Mar, 2019, 5:29 AM Mike Dewhirst, > wrote:


On 8/03/2019 10:11 am, Tal wrote:
> The word "simple" appears 13 times in PEP, but no one knows how
> this magical specification works?
> Can anyone confirm I'm not crazy please?

You could try writing to Grahame Dumpleton for confirmation. I'm
reasonably sure he wrote mod_wsgi and ought to be able to correct
you if
you've misunderstood anything.He used to give presentations on
wsgi at
PyCons so you might be able to find something on YouTube from a few
years ago.

Last I heard of him he is fairly focused on Kubernetes so he probably
doesn't monitor the Django list any more.

>
> On Tuesday, February 26, 2019 at 3:13:00 PM UTC-7, Tal wrote:
>
>     Is it right though?
>
>     On Tuesday, February 26, 2019 at 2:49:03 PM UTC-7, mike wrote:
>
>         Great write up!
>
>         On Tue, Feb 26, 2019 at 2:39 PM Tal mailto:tal@gmail.com>> wrote:
>
>             Did I get something wrong?
>             Do you mean the devs working on the Django project know
>             nothing about this, or the devs using Django to
build web
>             apps?
>             From what I've read, devs using Django don't need to be
>             too familiar with WSGI, but it seems like it helps at
>             least having a conceptual understanding of what it is.
>
>             On Tuesday, February 26, 2019 at 12:28:26 PM UTC-7,
Motaz
>             Hejaze wrote:
>
>                 You are very close to what realy happens , most of
>                 devs know nothing aboutbthis stuff
>
>                 On Tue, 26 Feb 2019, 20:26 Tal,
mailto:tal@gmail.com>> wrote:
>
>                     I've been developing web applications using
Flask
>                     and Django for about a year now, and
although I've
>                     come across the term WSGI a bunch of times
in both
>                     frameworks, I never really understood what
it did.
>                     I'm sure I'm not the only one. The quick
>                     explanations I read never made sense to me. Even
>                     PEP didn't really give me a clear picture of
>                     how WSGI fits in with Nginx, and Django.
There are
>                     a bunch of articles online that quickly show how
>                     to setup nginx, gunicorn/uwsgi and django to
work
>                     in production, and once I figured that out, I
>                     never really had a reason to figure out WSGI
>                     again. But it's been a year now, and I probably
>                     should understand at least the basics.
>
>                     I did a bit more reading recently, and I think I
>                     get it. Just looking for someone to confirm that
>                     I'm on the right track.
>                     This is how I think it works:
>
>                     My example uses the most common setup I use:
>                     Nginx, Gunicorn and Django
>
>                       * When an HTTP request comes in, it hits
Nginx first
>                           o Nginx runs multiple processes, and makes
>                             sure that browsers/clients that have a
>                             slow connection don't effect other
clients
>                           o If it's a request for a static file,
like
>                             a CSS file, JS, image, or anything like
>                             that, Nginx returns it directly
>                           o If it's a request for anything else, it
>                             uses *HTTP* to send the request over a
>                        

Re: Missing manage.py & settings.py

2019-03-07 Thread lujate
I'm sorry,  I don't understand what you're trying to say.

On Thu, Mar 7, 2019, 12:23 AM Gil Obradors  For create it  yourself from 0
>
> El dj., 7 de març 2019, 01:05, lujate  va
> escriure:
>
>> What purpose does startapp serve when you're only using a pip installed
>> app?
>>
>>
>>
>> On Wed, Mar 6, 2019, 11:12 AM ambesh chand shahi > wrote:
>>
>>> You should first type django-admin startproject "your project name".
>>>
>>> Then if you are using python3 then type python3 manage.py startapp
>>> "appname".
>>>
>>> After that include that app in settings.py in Installed apps.
>>>
>>>
>>> On Tue, 5 Mar 2019, 07:29 lujate,  wrote:
>>>
 I created a scratch project for R&D.
 I did a runserver and confirmed the default landing page.
 I added the apps to the settings file per the docs.
 I ran a migrate per the docs and got an error on one of the apps.
 I tried a runserver and got the same error.
 I dug into site-packages and confirmed the app was there.

 I added multiple apps, and there's only an error on one. I don't know
 if that's because the others are fine,  or it just stopped at the first
 error.

 Thanks

 On Mon, Mar 4, 2019, 6:59 PM Mario Martinez >>> wrote:

> Did you run the django-admin startproject your_project_name command?
>
> On Fri, Mar 1, 2019, 6:13 PM lujate  wrote:
>
>> I pip installed a Django project, but it doesn’t have a manage.py or
>> settings.py.  I checked the repo on GitHub, and those files don’t exist
>> there either.  Is this an alternate way of doing a Django project that 
>> I’m
>> not aware of?
>>
>> FWIW, the project is django-wiki.
>>
>> TIA
>>
>> --
>> 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/30fc5fdc-6bd6-4807-99ff-c41e6e109642%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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/UNcOwcHuox8/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/CAOXNLNvP-vePzZj1zEeN-kVRiBPwEk_A6x64aJ0Y312uaegE3w%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/CAA4ZjbSQQP-X6jmaYxGNCjtoSzWTG-ZdwXohYwJv-yo6-2Gwqw%40mail.gmail.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>> --
>>> 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/UNcOwcHuox8/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/CA%2BM-f1c2ycqtZ4i%3DPBs6nS6n9MP6FV959XdmmtGBOb3Sn%3DO5yg%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optou

Re: ModuleNotFoundError: No module named 'sample,'

2019-03-07 Thread lakshmyyreddy
yes I added


On Thursday, 7 March 2019 19:09:03 UTC+5:30, 赖信桃 wrote:
>
> Did you add `sample` to INSTALLED_APPS?
>
> > 于2019年3月7日周四 下午5:44写道:
>
>> Hi Team
>>
>> My project name is Sample
>> While I am trying to connect database with models.py 
>> I am finding these type of errors
>> ModuleNotFoundError: No module named 'sample,'
>> Can anybody 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...@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/94eba992-1553-40a5-8a58-4f9ad85bbd5c%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/4245ebc4-6bcc-47aa-93f5-f2d62d39c9ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ModuleNotFoundError: No module named 'sample,'

2019-03-07 Thread lakshmyyreddy
Hi,every body 
I started working on Django recently
I am trying to connect database through models.py 
But I have getting these type of errors
can anybody help me how can I fix those errors and how to connect database 
for user registrations

-- 
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/fd9854ef-1545-40e0-91d2-986f539c759b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.