Cannot find django.views.generic . Where is generic. Looked in all folders for the file
<p>I know this is a strange question but I am lost on what to do. i cloned pinry... It is working and up . I am trying to find django.views.generic. I have searched the directory in my text editor, I have looked in django.views. But I cannot see generic (only a folder with the name "generic"). I cant understand where the generic file is . It is used in many imports and to extend classes but I cannot find the file to see the import functions. I have a good understanding of files and imports and i would say at this stage I am just above noob level. So is there something I am missing here. How come i cannot find this file? If i go to from django.core.urlresolvers import reverse, I can easly find this but not 
 eg : from django.views.generic import CreateView</p>

<p>Where is generic?</p>

<p>Try running this from a Python interpreter: </p>

<pre><code>&gt;&gt;&gt; import django.views.generic
&gt;&gt;&gt; django.views.generic.__file__
</code></pre>

<p>This will show you the location of the <code>gerneric</code> as a string path. In my case the output is:</p>

<pre><code>'/.../python3.5/site-packages/django/views/generic/__init__.py'
</code></pre>

<p>If you look at this <code>__init__.py</code> you will not see the code for any of the generic <code>*View</code> classes. However, these classes can still be imported from the path <code>django.views.generic</code> (if I am not mistaken, this is because the <code>*View</code> classes are part of the <a href="http://stackoverflow.com/a/44843/3642398"><code>__all__</code></a> list in <code>django/views/generic/__init__.py</code>). In the case of <code>CreateView</code>, it is actually in <code>django/views/generic/edit.py</code>, although it can be imported from <code>django.views.generic</code>, because of the way the <code>__init__.py</code> is set up.</p>

<p>This is technique is generally useful when you want to find the path to a <code>.py</code> file. Also useful: if you use it on its own in a script (<code>print(__file__)</code>), it will give you the path to the script itself.</p>

python django generics