why isn't my image being uploaded with the django form I created?
<p>I am using Python 2.7, Django 1.9.</p>

<p>I'm trying to get an image from the user with this model/form pair:</p>

<p>models.py</p>

<pre><code>from PIL import Image
class UserProfile(models.Model):

    user = models.OneToOneField(User)

    website = models.URLField(blank=True, null=True)
    location = models.CharField(max_length=200, null=True)
    longitude = models.FloatField(null=True)
    latitude = models.FloatField(null=True)
    credit = models.FloatField(default=0, null=True)
    picture = models.ImageField(upload_to='media/images/profile_pictures', blank=True, null=True)

    def __unicode__(self):
        return self.user.username
</code></pre>

<p>forms.py</p>

<pre><code>class UserProfileForm(forms.ModelForm):
    class Meta:
        model = UserProfile
        fields = [
            "website",
            "location",
            "picture",
        ]
        widgets = {
            'location': forms.TextInput(
                attrs={'id': 'location', 'class': 'geo', 'required': True, 'placeholder': 'location'}
            ),
        }
</code></pre>

<p>This is saved using the following view:  </p>

<pre><code>def register(request):
    registered = False
    if request.method == "POST":
        user_form = UserForm(request.POST)
        profile_form = UserProfileForm(request.POST, request.FILES)

        if user_form.is_valid() and profile_form.is_valid():
            print(request.POST['location'])
            print(str(request.POST['location']))
            user = user_form.save()                
            user.set_password(user.password)
            user.save()
            profile = profile_form.save(commit=False)
            profile.user = user
            profile.save()
        else:
            print user_form.errors, profile_form.errors

    else:
        profile_form = UserProfileForm()
        user_form = UserForm()

    return render(request, "register.html", {'user_form' : user_form, 'profile_form' : profil
</code></pre>

<p>But upon execution, no pictures are saved to the folders.  Here is the root of the image_urls:
project/static/media/images/profile_pictures
Any ideas?</p>

<p>Edit: Here's the html:</p>

<pre><code>{% load static from staticfiles %}
{% block head %}


{% endblock %}
{% block content %}


{% if registered %}
&lt;h1&gt;Thank you for registering.&lt;/h2&gt;&lt;br&gt;
&lt;a href="dashboard"&gt;Start playing!&lt;/a&gt;
{% else %}

&lt;form id="user_form"  method="post" action="/register/" enctype="multipart/form-data"&gt;
  {% csrf_token %}
  {{ user_form.as_p }}
  {{ profile_form.as_p }}
  &lt;input type="submit" name="submit" value="register" /&gt;

&lt;/form&gt;

{% endif %}
{% endblock %}
</code></pre>

<p>Are you using the correct dependencies for processing images?</p>

python django forms python-imaging-library pillow