Staticfiles #889

Closed
wants to merge 16 commits into
from

Conversation

Projects
None yet
2 participants
Contributor

AdrianRibao commented Jun 27, 2011

Using django.contrib.staticfiles from Django 1.3 to serve static files.

AdrianRibao added some commits Apr 18, 2011

@AdrianRibao AdrianRibao Changing the way static files are served. Now is using django v1.3
staticfiles.
e20e81e
@AdrianRibao AdrianRibao Manage CSRF tokens in ajax views 1fa74b4
@AdrianRibao AdrianRibao WYMEditor widget fix 5e0dab8
@AdrianRibao AdrianRibao Corrected Spanish traslation 3fb0d12
@AdrianRibao AdrianRibao Manage CSRF tokens in the toolbar 862f409
@AdrianRibao AdrianRibao Changed settings to run tests 2b0f3e6
@AdrianRibao AdrianRibao Merge branch 'develop' of git://github.com/divio/django-cms into stat…
…icfiles

Conflicts:
	cms/conf/global_settings.py
	cms/forms/widgets.py
	cms/middleware/toolbar.py
	cms/plugins/flash/templates/cms/plugins/flash.html
	cms/plugins/twitter/cms_plugins.py
	cms/plugins/video/templates/cms/plugins/video.html
	cms/static/cms/js/toolbar.js
	cms/static/cms/plugins/twitter/js/jquery.tweet.js
	cms/templates/admin/cms/page/change_list.html
	cms/templates/admin/cms/page/plugin_forms_ok.html
	cms/templates/cms/toolbar/toolbar.html
7e343f9
@AdrianRibao AdrianRibao More changes in the STATIC_URL paths f475713
@AdrianRibao AdrianRibao Moved some files to static directory 518f9b1
@AdrianRibao AdrianRibao Added some missing files c4ffac9
@AdrianRibao AdrianRibao More extra files that were ignored by .gitignore 9272f23
@AdrianRibao AdrianRibao fix in a path 01918cb
@AdrianRibao AdrianRibao Merge branch 'develop' into staticfiles cdd2e6c
@AdrianRibao AdrianRibao Merge remote-tracking branch 'upstream/develop' into staticfiles
Conflicts:
	cms/locale/es/LC_MESSAGES/django.po
	cms/media/cms/js/libs/classy-1.3.1.js
	cms/media/cms/js/libs/classy.min.js
	cms/media/cms/js/libs/swfobject-2.2.js
	cms/media/cms/js/libs/swfobject.min.js
	cms/middleware/toolbar.py
	cms/plugins/flash/templates/cms/plugins/flash.html
	cms/plugins/text/templates/cms/plugins/text_plugin_change_form.html
	cms/plugins/text/templates/cms/plugins/widgets/wymeditor.html
	cms/plugins/video/templates/cms/plugins/video.html
	cms/static/cms/js/change_list.js
	cms/static/cms/js/libs/classy-1.3.1.js
	cms/static/cms/js/libs/swfobject-2.2.js
	cms/static/cms/js/tools.js
	cms/templates/admin/cms/page/change_form.html
	cms/templates/admin/cms/page/change_list.html
	cms/templates/cms/toolbar/toolbar.html
ffd7bc0

@ojii ojii and 1 other commented on an outdated diff Jun 27, 2011

cms/locale/es/LC_MESSAGES/django.po
msgstr "¿Seguro que desea eliminar este 'plugin'?"
+>>>>>>> upstream/develop
@ojii

ojii Jun 27, 2011

Collaborator

erm.. looks like a merge conflict here

@AdrianRibao

AdrianRibao Jun 27, 2011

Contributor

I just removed the single quotes in the string. It was raising a problem. I'm Spanish, it makes more sense without the single quotes.

@ojii

ojii Jun 27, 2011

Collaborator

I mean the +>>>>>>> upstream/develop stuff in there

@AdrianRibao

AdrianRibao Jun 27, 2011

Contributor

You are right. I've already solved the conflict.

@ojii ojii commented on the diff Jun 27, 2011

cms/forms/widgets.py
@@ -130,13 +130,13 @@ class PluginEditor(Widget):
self.attrs = {}
class Media:
- js = [join(settings.CMS_MEDIA_URL, path) for path in (
+ js = [join(settings.STATIC_URL, 'cms', path) for path in (
@ojii

ojii Jun 27, 2011

Collaborator

I know it's not your fault, but using os.path.join here is completely wrong, on windows this will not work. while we're at it, can you change those to '/'.join(...)?

EDIT: just noticed it's all over the place, this comment is for everywhere where os.path.join is used for URLs

@AdrianRibao

AdrianRibao Jun 27, 2011

Contributor

I think these changes should be made out of the staticfiles branch, since it doesn't have nothing to do with it.

@ojii

ojii Jun 27, 2011

Collaborator

well on that note, most changes in this pull request should not be made

@ojii ojii and 1 other commented on an outdated diff Jun 27, 2011

cms/conf/global_settings.py
CMS_MEDIA_PATH = 'cms/'
-CMS_MEDIA_ROOT = os.path.join(settings.MEDIA_ROOT, CMS_MEDIA_PATH)
-CMS_MEDIA_URL = os.path.join(settings.MEDIA_URL, CMS_MEDIA_PATH)
+CMS_MEDIA_ROOT = os.path.join(STATIC_ROOT, CMS_MEDIA_PATH)
+STATIC_URL = 'static/'
@ojii

ojii Jun 27, 2011

Collaborator

should this really be here?

@AdrianRibao

AdrianRibao Jun 27, 2011

Contributor

Not really, I've removed them in a new commit.

@ojii ojii and 1 other commented on an outdated diff Jun 27, 2011

cms/conf/global_settings.py
@@ -100,9 +100,10 @@ CMS_FRONTEND_LANGUAGES = [x[0] for x in CMS_LANGUAGES]
# Path for CMS media (uses <MEDIA_ROOT>/cms by default)
+STATIC_ROOT = getattr(settings, 'STATIC_ROOT', 'cms/')
@ojii

ojii Jun 27, 2011

Collaborator

why is this in global_settings, doesn't look cms specific

@AdrianRibao

AdrianRibao Jun 27, 2011

Contributor

Both of them have been removed.

@ojii ojii and 1 other commented on an outdated diff Jun 27, 2011

cms/plugins/file/cms_plugins.py
@@ -20,6 +20,6 @@ class FilePlugin(CMSPluginBase):
def icon_src(self, instance):
file_icon = instance.get_icon_url()
if file_icon: return file_icon
- return settings.CMS_MEDIA_URL + u"images/plugins/file.png"
+ return settings.STATIC_URL + u"cms/" + u"images/plugins/file.png"
@ojii

ojii Jun 27, 2011

Collaborator

can we have string formatting using %s here? the + operator just fails too often compared to %s

@AdrianRibao

AdrianRibao Jun 27, 2011

Contributor

Ok, this has been changed in a new commit.

@ojii ojii commented on the diff Jun 27, 2011

cms/static/cms/css/pages.css
@@ -330,7 +328,6 @@ div#sitemap ul.header li{
#sitemap ul.header li .col-moderator,
#sitemap ul.header li .col-lastchange,
#sitemap ul.header li .col-draft,
-#sitemap ul.header li .col-view-perms,
@ojii

ojii Jun 27, 2011

Collaborator

why are those 3 css classes removed?

@AdrianRibao

AdrianRibao Jun 27, 2011

Contributor

Honestly, I don't know. Maybe git solved the conflicts automatically and I didn't realize.

Same thing happens with toolbar.css

What is the best way to undo this changes?

@ojii ojii commented on the diff Jun 27, 2011

cms/static/cms/css/toolbar.css
+ background: #0095cd;
+ background: -webkit-gradient(linear, left top, left bottom, from(#00adee), to(#0078a5));
+ background: -moz-linear-gradient(top, #00adee, #0078a5);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00adee', endColorstr='#0078a5');
+}
+.blue:hover {
+ background: #007ead;
+ background: -webkit-gradient(linear, left top, left bottom, from(#0095cc), to(#00678e));
+ background: -moz-linear-gradient(top, #0095cc, #00678e);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0095cc', endColorstr='#00678e');
+}
+.blue:active {
+ color: #80bed6;
+ background: -webkit-gradient(linear, left top, left bottom, from(#0078a5), to(#00adee));
+ background: -moz-linear-gradient(top, #0078a5, #00adee);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0078a5', endColorstr='#00adee');
}
@ojii

ojii Jun 27, 2011

Collaborator

what's the reason for these CSS changes? Why are there CSS changes in a pull request for staticfiles?

@ojii ojii commented on the diff Jun 27, 2011

cms/static/cms/js/plugin_editor.js
@@ -1,7 +1,6 @@
(function($) {
$(document).ready(function() {
// Add Plugin Handler
- $.fn.cmsPatchCSRF();
@ojii

ojii Jun 27, 2011

Collaborator

???

Collaborator

ojii commented Jun 27, 2011

okay I'm gonna close this pull request, please submit a new one which is simpler than this one and has no random js/css changes, thank you. same goes for locale changes...

ojii closed this Jun 27, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment