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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:43:09+00:00 2026-06-15T19:43:09+00:00

While trying to load custom templtetags, I got error ‘myapp’ is not a valid

  • 0

While trying to load custom templtetags, I got error

'myapp' is not a valid tag library: ImportError raised loading myapp.templatetags.myapp: No module named models

The problem is in templatetags/myapp.py is not been able to load model -> “myapp: No module named models”. Why following line fails in myapp/templatetags/myapp.py?

from myapp.models import Mymodel

To give some details, I have following:

myproject
 |
  --myapp
 |   |
 |   --templatetags
 |   |   |
 |   |    --__init__.py
 |   |    --myapp.py
 |   --__init__.py
 |   --models.py
 |   --views.py
 |
  --myapp2
 |   |
 |   --templatetags
 |   --__init__.py
 |   --models.py
 |   --views.py

In the template/myapp2/showsomething.html, I have following

{% load myapp %}

In the myapp/templatetags/myapp.py, I have following

from myapp.models import Mymodel
register = Library()

@register.inclusion_tag('myapp/myapp.html')
def myapp():
    #....somecode ...   
    return {'some': 'value}

In the myapp/models.py, I have following

from django.db import models
class Mymodel(models):
    ...some model code

In settings.py, I have

...some other settings code ...

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.admin',
    'myapp',
    'myapp2',

)

  • 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-15T19:43:10+00:00Added an answer on June 15, 2026 at 7:43 pm

    Django is probably confused because of same name. Try to rename the file myapp.py to something else.
    Also, You need to add the template tag app to the Installed apps and make sure the template tag has the __init__.py file. More information could be find here

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

Sidebar

Related Questions

Got this error message while trying to load view: The model item passed into
While trying to load a Bitmap onto a SWFLoader the Event.COMPLETE event is not
I am struggling a little bit while trying to display a custom 404 error
I'm getting the following error while trying to load some projects in visual studio
I'm working on a custom ROM and I'm receiving this error while trying to
I ran into a bit of trouble while trying to load an external HTML
I'm trying to load page and then remove some elements in it. While doing
I am facing this error, Cannot create unknown Type '{clr- namespace:ActivityLibrary1;assembly=ActivityLibrary1}MyActivity1' while trying to
I have been running into OutOfMemory Exceptions while trying to load an 800MB text
While trying to install opennms : /usr/share/opennms/bin/install -l /usr/local/lib -dis I get the error:

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.