0

Hi I have a scenario where user inputs css data in text box, I need to read it and apply it to a django view. I also need to store the css data for future modifications by user.

So my question is 1.should I store the css data in database or 2.in a static css file and store path to file in db?

Thanks.

2
  • 2
    store path will be easiser than storing th css. or you can pickle the css and store it db Commented Sep 9, 2014 at 5:01
  • @sundarnatarajСундар CSS is just text. You needn't pickle it. In fact there is nothing easier than storing CSS in DB. Commented Sep 9, 2014 at 7:46

1 Answer 1

1

There is absolutely no problem with storing CSS in DB. Just create a TextField in your model and put it there.

Then in your view's template output it in a <style type="text/css"> tag and that's all.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.