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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:09:48+00:00 2026-05-20T13:09:48+00:00

I am working on a application, which was written by other people. It actively

  • 0

I am working on a application, which was written by other people. It actively uses the sites framework to serve two different gaming sites. These sites run on the same code, on the same database:

class Entry(models.Model):
    headline = models.CharField(max_length=100)
    body = models.TextField()
    created = models.DateTimeField()
    creator = models.ForeignKey(User)

    # Site1 fields
    best = models.BooleanField()
    is_editor_post = models.BooleanField()
    site1_views = models.IntegerField()
    cnt_comments = models.IntegerField()
    last_edit = models.DateTimeField()
    editor = models.ForeignKey(User)
    tags = models.ManyToManyField(Tag)

    # Site2 fields
    category = models.ForeignKey(Category)
    blog = models.ForeignKey(Blog)
    site2_views = models.IntegerField()

class Game(models.Model):
    name = models.CharField(max_length=100)
    description = models.TextField()
    genre = models.ForeignKey(Genre)
    release_date = models.DateField()
    platform = models.ForeignKey(Platform)

    # Site1 fields
    mark = models.IntegerField()
    badges = models.ManyToManyField(Badge)
    badges_updated = models.DateTimeField()

    # Site2 fields
    requirements = models.CharField(max_length=255)
    status = models.IntegerField()
    has_news = models.BooleanField()
    has_articles = models.BooleanField()
    has_screenshots = models.BooleanField()

    class Meta:
       permissions = (
           ('site1_add_game', 'Site1/Can add game'),
           ('site2_add_game', 'Site2/Can add game'),
       )

As you can see, there is a bunch of fields, useless for one of the sites. Also, we don’t use default permissions, but instead create our own. This is because the users a shared between the two sites, and one use could have right to add games on both sites, while another person is only able to add it on site2.

There is also a lot of code in views, model and manager methods like this:

def get_related_entries(self):
    if settings.SITE_ID == 1:
       # code for finding related entries on site1
    elif settings.X_SITE_ID == 2:
       # code for finding related entries on site2
    return entries

So when I am working on site1 code, the fields and code from site2 is just confusing me.
If I add a feature to the first site, most often I don’t need such a feature on another. Also I will probably have to write a third site, and they want this site to be running on the same code and database. Why? Because they think this enables code reusing and sharing content between different sites. This sounds really good, and there is really a bunch of code, which is common beetween the sites. But there is also very much differences in the sites logic and models structure to run them on the same code.

The code is very hard to maintain, and it just looks ugly and not straightforward. The solution might be to separate common apps, and site-specific apps. But almost all apps have site-specific code. I think it would be much simpler if I had two different projects, each one with its own code and models.

So, is the sites framework is suitable here? When is it suitable? Why does Django “strongly encourages” it’s using?

  • 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-20T13:09:49+00:00Added an answer on May 20, 2026 at 1:09 pm

    Even though i haven’t much experience with the sites framework, i think it mostly makes sense when you want to use the same admin interface for all sites. And that’s a requirement you haven’t even mentioned.

    Recently i considered using it, but after some inital coding i decided against it. Things got complicated very quick. If statements everywhere, extra fields that i basically needed only on one site, permission handling looked tricky, pretty much all what you have mentioned.

    I’m sure there are use cases for the sites framework, but when in doubt i would go for separate projects with reusable apps where the models can be subclassed when needed.

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

Sidebar

Related Questions

I'm currently working on an application written in C#, which I'm embedding IronPython in.
I am working on application which needs to be authenticated in different domain. To
I am currently working on a mobile application framework written in HTML 5, CSS3
Working with the Google Web Toolkit i have written an application which is based
i am working on an application which consist of two part one web based
I have written standalone application which is working in Windows Azure as startup task.
I am working on an application which starts as a service but only if
I'm working on an application which stores data in tables, similar to an RDBMS.
I'm working on an application which has data imported from a foreign (and wholly
I am working on an application which sends an AJAX POST request (I'm using

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.