Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 555495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:49:14+00:00 2026-05-13T11:49:14+00:00

from django import forms class a(forms.Form): name = forms.CharField(initial=’Your name’) url = forms.URLField(initial=’Your Web

  • 0
from django import forms

class a(forms.Form):
    name = forms.CharField(initial='Your name')
    url = forms.URLField(initial='Your Web site')
    comment = forms.CharField()
data = {'name': 'hahaha', 'url': '', 'comment': 'Foo'}

f = a(data,auto_id=False)

#print f.is_valid()
print f.errors

errors:

Traceback (most recent call last):
  File "D:\zjm_code\register\registration\a.py", line 15, in <module>
    print f.errors
  File "D:\Python25.4\Lib\site-packages\django\utils\encoding.py", line 32, in __str__
    return self.__unicode__().encode('utf-8')
  File "D:\Python25.4\Lib\site-packages\django\forms\util.py", line 21, in __unicode__
    return self.as_ul()
  File "D:\Python25.4\Lib\site-packages\django\forms\util.py", line 27, in as_ul
    for k, v in self.items()]))
  File "D:\Python25.4\Lib\site-packages\django\utils\encoding.py", line 71, in force_unicode
    s = unicode(s)
  File "D:\Python25.4\Lib\site-packages\django\forms\util.py", line 37, in __unicode__
    return self.as_ul()
  File "D:\Python25.4\Lib\site-packages\django\forms\util.py", line 42, in as_ul
    % ''.join([u'<li>%s</li>' % conditional_escape(force_unicode(e)) for e in self]))
  File "D:\Python25.4\Lib\site-packages\django\utils\encoding.py", line 71, in force_unicode
    s = unicode(s)
  File "D:\Python25.4\Lib\site-packages\django\utils\functional.py", line 201, in __unicode_cast
    return self.__func(*self.__args, **self.__kw)
  File "D:\Python25.4\Lib\site-packages\django\utils\translation\__init__.py", line 62, in ugettext
    return real_ugettext(message)
  File "D:\Python25.4\Lib\site-packages\django\utils\translation\__init__.py", line 32, in delayed_loader
    if settings.USE_I18N:
  File "D:\Python25.4\Lib\site-packages\django\utils\functional.py", line 269, in __getattr__
    self._setup()
  File "D:\Python25.4\Lib\site-packages\django\conf\__init__.py", line 38, in _setup
    raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE)
ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:49:14+00:00Added an answer on May 13, 2026 at 11:49 am

    That error shows up because you’re not running the script as part of a Django app. There are a number of measures you can take to get it to work, but having a form separate from the app will probably not be terribly useful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following form: from django import forms class ContactForm(forms.Form): name = forms.CharField()
This is my form: from django import forms class UploadFileForm(forms.Form): titl = forms.CharField(max_length=50) ffile
I have a form like: #forms.py from django import forms class MyForm(forms.Form): title =
I have the following model: from django.db import models class State(models.Model): name = models.CharField(max_length=30)
Using django-contact-form , I have overridden the form class: from contact_form.forms import ContactForm from
I would like to style the following: forms.py: from django import forms class ContactForm(forms.Form):
from django import forms class ActonForm(forms.Form): creator = forms.RegexField('^[a-zA-Z0-9\-' ]$',max_length=30, min_length=3) data = {'creator':
from django import forms class UserForm(forms.ModelForm): first_name = forms.TextField(label=_(u'First name'), required=False) last_name = forms.TextField(label=_(u'Last
on a django shell i tried from django import forms class A(forms.Form): x =
Why can't I do this? from django import forms from django.forms import widgets class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.