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 8170867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:16:42+00:00 2026-06-06T21:16:42+00:00

i am using pycharm with django. When i do the runserver command, my project

  • 0

i am using pycharm with django. When i do the runserver command, my project starts up and everything is fine.

if i use the pycharm run command – that green arrow at the top – then i get problems.

The problems are:

runnerw.exe C:\development\python\python.exe manage.py runserver 127.0.0.1:8000

Traceback (most recent call last):

File “manage.py”, line 11, in
import settings

File “C:\development\PycharmProjects\dumpstown\settings.py”, line 185, in
add_to_builtins(‘gravatar.templatetags.gravatar’)

File “C:\development\python\lib\site-packages\django\template\base.py”, line 1017, in add_to_builtins
builtins.append(import_library(module))

File “C:\development\python\lib\site-packages\django\template\base.py”, line 963, in import_library

raise InvalidTemplateLibrary("ImportError raised loading %s: %s" % (taglib_module, e))

django.template.base.InvalidTemplateLibrary: ImportError raised loading

gravatar.templatetags.gravatar: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.

Process finished with exit code 1

And stem from my use of add_to_builtins here: (this is in the settings.py file)

#gravatar stuff here.
add_to_builtins('gravatar.templatetags.gravatar')

I know this is the problem, because if i remove this line in the settings.py file? everything works fine.

Is there a way to remedy this problem for pycharm?

  • 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-06-06T21:16:44+00:00Added an answer on June 6, 2026 at 9:16 pm

    You need to set your Django settings module in Settings | Django Support | Settings

    http://www.jetbrains.com/pycharm/webhelp/django-support.html

    UPDATED

    The problem with django-gravatar is that it’s templatetags import django.contrib.auth.models.User which relies on settings module while setting module is loaded in Django by DJANGO_SETTINGS_MODULE environment variable, which is set internally by execute_manager function call in manage.py, which is executed AFTER import of settings. So when you use undocumented add_to_builtins feature just in settings.py at that point you have no DJANGO_SETTINGS_MODULE env variable set. So that is not a problem of PyCharm, but a problem of unset environment variable and usage of undocumented Django feature add_to_builtin.

    When I ran the same project from Unix console I get the same error.

    Probably you have DJANGO_SETTINGS_MODULE set in your environment if it works from console.
    So to make it work in PyCharm you need to set up the variable in Django run configuration.
    You can read here about that (see Environment variable section).

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

Sidebar

Related Questions

I'm using PyCharm to write the code of a Django project I'm developing. My
I'm developing a web app in Python 2.7 using Django 1.4 with PyCharm 2.5
I am using the Python IDE PyCharm and something that is have by default
Using the C# Facebook SDK 5.0.3 everything works fine whit the client.Get(/me). But when
Using the Redis info command, I am able to get all the stats of
I'm using PyCharm on a Windows machine, and I'm running the tutorial found here
I've started on a medium-sized project in python, and I decided to use python
I'm using PySide with PyCharm. When I want to jump to the source of
Using Git Bash or MinGW Shell , if I put in a command with
Using mercurial, I've run into an odd problem where a line from one committer

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.