# ucommentapp / conf / settings.py

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 from django.conf import settings as DJANGO_SETTINGS from os import getcwd, sep from tempfile import mkdtemp STATIC_URL = DJANGO_SETTINGS.STATIC_URL MEDIA_URL = DJANGO_SETTINGS.MEDIA_URL MEDIA_ROOT = DJANGO_SETTINGS.MEDIA_ROOT EMAIL_FROM = DJANGO_SETTINGS.EMAIL_FROM ADMINS = DJANGO_SETTINGS.ADMINS del DJANGO_SETTINGS # Leads to recursion depth errors when unpickling by Sphinx # # Application settings (do not edit these 3 settings) # -------------------- application_path = __file__[0:__file__.find('conf' + sep + 'settings.py')] app_dirname = application_path.split(sep)[-2] ucomment_ver = getattr(__import__(app_dirname, None, None), '__version__') # Comment settings # ---------------- # Enable commenting? Set to False and restart the Django server to instantly # turn off commenting. Existing comments will also not be displayed. enable_comments = True # Number of characters for the comment root (added to RST text file sources) root_node_length = 6 # Number of characters identifying a comment on a page (unique within each root) short_node_length = 2 # Minimum and maximum number of characters required for a user comment comment_min_length = 10 comment_max_length = 5000 # Number of comments before the user's future comments are auto-approved number_before_auto_approval = 3 # Approval code generation: number of characters for matching approval code approval_code_length = 42 # Repository settings # ------------------- # Which type of Distributed Version Control System (DVCS) are you using? # Must be one of ['hg']. # # As you can see, we currently only support mercurial repositories. # Future plans will extend this list to include 'svn' & 'git'. # DEVELOPERS: The repository manipulation code is in a wrapper file, so that # you can replace it with your preferred DVCS's code. Please use "hgwrapper.py" # as a template to start from. repo_DVCS_type = 'hg' # The full path and file name to the executable command that runs the DVCS. repo_DVCS_exec = '/usr/local/bin/hg' # The source code for your document. This must be a valid repository containing # all the RST source files. Also, when the repository is cloned from the # remote repo (see the setting below) the Sphinx conf.py file, and # master_doc file specified in that conf.py file should be in remote repo. # # Please used the fully qualified path, e.g. http://bitbucket.org/kevindunn/doc # Type "hg help urls" to get help on Mercurial URLs. Also, set your # authentication information in the .hg/hgrc file to allow automatic pushing # back to this remote repo. remote_repo_URL = r'http://hg.connectmv.com/ucommentapp-documentation/' # This is the local repository of the document. It is a clone of the full # document's source, with all revisions. It is also the location where the RST # is converted to HTML, and where comments are added to the RST sources. # Changes made to this repo are pushed back to the remote repo. local_repo_physical_dir = application_path + 'document_compile_area/' # Same as the above, but use the URL notation required for the version control # system (in this case, Mercurial) local_repo_URL = r'file://' + application_path + '/document_compile_area/' # HTML settings # ------------- # Location on server for any media in your document: images, CSS files, # Javascript files, etc. Usually the defaults: # media_root = MEDIA_ROOT # media_url = MEDIA_URL # (capitilized versions are from your Django project) are OK. But you might # want to separate the media for this Django application from other apps. # e.g. media_root = MEDIA_ROOT + sep + 'ucomment' + sep # Absolute path to the directory that holds media; must end with a slash # Example: '/var/www/media.example.com/' media_root = MEDIA_ROOT # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). # Example: "http://example.com/media/" or even just '/media/' media_url = MEDIA_URL # Web link to the stylesheet: stylesheet_link = media_url + 'ucomment.css' + '?' + ucomment_ver # Web link to the Javascript file: js_file = media_url + 'ucomment.js' + '?' + ucomment_ver # Do you mathematics in your documents? Will your users want to write math # in their comments? Consider using MathJax for good looking math in HTML. # http://www.mathjax.org/community/mathjax-in-use/ # # Set this setting to the empty string ('') if you don't need math. # Also, adjust the USE_MATHJAX setting at the top of the ucomment Javascript # file, js_file, to turn on MathJax. mathjax_file = '' # or point to MathJax files: MEDIA_URL + 'MathJax/MathJax.js' # These line(s) of text will be placed in front of the HTML served by Django. html_prefix_text = """ """ % (media_url, media_url, media_url, media_url) # These line(s) of text will be placed at the end of the HTML served by Django. html_suffix_text = ('\n' '\n') % \ (media_url, js_file) if mathjax_file: html_suffix_text += ('\n' '\n') % mathjax_file # This is the place to append any Analytics codes, e.g. Google Analytics: # html_suffix_text += "Analytics code from vendor." # We offer some help to new users in the tab of the comment dialog box # that pops up. This is the text that is given by default. You should # use valid HTML, and links to any pictures must point to the correct # server location. html_about_commenting = r'''

This pages uses a commenting system to obtain your feedback. Feel free to ask questions, provide your perspective, or leave a relevant comment on any block of text, bullet point, code, or chunck of content.

To get started, please click on the vertical sidebar, near the content you would like to comment on. It will highlight the section you are commenting on.

Please note that we reserve the right to edit or remove a comment, and that you give us permission to use your contribution.

How to comment

• Italics:    *italic text*
• Bold text:     **bold text**
• monospaced text:     monospaced text (use backquotes)
• Hyperlinks are automatically detected:      http://ucomment.org shows up as http://ucomment.org
• Unnumbered bullet points use * asterisks, while numbered points use a # hash mark.
* This is a bulleted list. * It has two items, the second   item uses two lines.   #. Point one.   #. Point two.
• Mathematics: $$e^{i\pi} + 1 = 0$$ will show as Euler's famous equation, $$e^{i\pi} + 1 = 0$$, if the site administrator has allowed mathematics in the comments. Similarly, you can use $...$ to write a stand-alone mathematical equation.

{{page.local_toc}} {% endif %} ''' # Django settings # --------------- # Assume this Django application is mounted at http://example.com/ucomment-app/ # and that this application was stored in the directory called "ucommentapp". # # Then you would had to add this line to the Django PROJECT's urls.py: # --------- # (r'^document/', include('ucommentapp.urls')), # # so users can access the document at: http://example.com/ucomment-app/document/ # When the ucomment application receives this URL, it must strip out the # document part. We call this this url_views_prefix. Do not add any # leading or trailing slash. If you mount the application at the server's # root, then set this to the empty string, ''. url_views_prefix = 'document' # Full path to where you would like the fixtures (back-ups) written to: # Alternative: use a directory from DJANGO_SETTINGS.FIXTURE_DIRS if you # have set it in your application. django_fixtures_dir = application_path + 'fixtures' # Send Python logging to this file: you must specify a valid, writable file log_filename = mkdtemp() + sep + 'ucomment-app.log' # Caching comment counts. Counting comments can be expensive. If the counting # takes longer than cache_count_duration seconds, then Django will cache # the counted result for cache_count_timout seconds. # There is no drawback to caching counts. If a new comment is approved then # the cache for page on which it appears is deleted. # You can set the cache_count_timout to zero (0) for no caching at all. # # You may need to specify CACHE_BACKEND is your Django settings.py file, # but if you haven't Django will use 'locmem://' as the cache. cache_count_duration = 0.6 cache_count_timout = 60 * 60 * 6 # Document splitting (experimental !) # ------------------ # Do you want to split up long RST files in the document ? If section_div # below is non-empty, then we will split the source RST files into smaller # sections, each on their own page, as defined by the heading labelsection_div # Which character is used to identify major sections within a chapter. Use # section_div = '' to prevent any file splitting. section_div = '' # How many consecutive characters do we look for to consider it a divider? # I.e. the default settings will split any title with '===' or more dividers. min_length_div = 3 # NOTE: Any RST file that contains a .. toctree:: directive will NOT BE # commentable. These RST files will automatically be added to the # skip_nodes_in list below. # RST compiling settings # ---------------------- # Do not allow commenting in these source files. # Do not use file extensions, and ensure the entries are relative to the source # directory. For example, skip_nodes_in = ['contents', 'chapter1/section-2'] skip_nodes_in = ['contents'] # Comment compiling settings # --------------------------- # Directory where Sphinx compiles the web visitor's comments; no trailing slash # Usually this directory is placed inside the Django application. Must be # writable by the webserver. comment_compile_area = application_path + 'comment_compile_area' # Email and message settings # --------------------------- # Email server details: please ensure the following 5 are set in your Django # project's settings.py file. Please visit # http://docs.djangoproject.com/en/dev/ref/settings/ if you are unsure of what # these mean. # EMAIL_HOST # EMAIL_PORT # EMAIL_HOST_USER # EMAIL_HOST_PASSWORD # EMAIL_FROM # Email address from which any email to users and admins is sent. email_from = EMAIL_FROM or 'Comments ' # Comment administrator email address(es): these people are emailed a link to # either approve or reject newly submitted comments. email_comment_administrators_list = [email_from] # Ucomment system administrators: the person/people that should receive emails # if any serious errors are encountered by the comment system. For example, when # a failed repository checkout or update occurs. # By default, use all email address(es) from your Django settings.py file. email_system_administrators = [email[1] for email in ADMINS] email_system_administrators_subject = 'Serious error: ucomment website' # Email the web user once their comment is submitted, but not approved yet. # Use the template below to structure the email. # You may set this to an empty string if you don't want an email sent. once_submitted_subject = 'Your comment submission to http://example.com' # This email will be sent (if user provided an email). once_submitted_template = '''\ {{poster.name}}, Thank you for submitting your comment to http://example.com - they are a \ valuable contribution to the site. A copy of your comment appears below. Comments are typically approved within 24 hours. After posting \ {{settings.number_before_auto_approval}} approved comments, any future \ comment you post will be automatically approved. Thanks again -- the http://example.com team. --- Your comment: {{comment.comment_RST}} --- Please note: If you did not submit this comment, then some one else used your \ email address on our website. Please reply to this email and let us know - we \ will remove the comment right away. Please quote reference number: {{comment.parent}}:{{comment.node}} ''' # This is the same version of the above message, except it is shown to the user # as HTML in the browser right after they submitted a comment. # Only settings and poster are available as template elements. # The comment object is not available. once_submitted_HTML_template = '''\

Thank you for submitting your comment to example.com - they are a valuable contribution to the site.

Comments are typically approved within 24 hours. After posting {{settings.number_before_auto_approval}} approved comments, any future comments you post will be automatically approved.

Thanks again, from Example, Inc.. ''' # Email web user once their comment is approved (mentions number of approved # comments they have to make before future comments are auto-approved). email_number_remaining = True once_approved_subject = 'Your comment on http://example.com is approved' once_approved_template = '''\ Your recent comment made on the http://example.com website was approved. {% if settings.email_number_remaining %} You have now posted {{poster.number_of_approved_comments}} comments. After you post {{settings.number_before_auto_approval}} approved comments, all your \ future comments will be automatically approved. {% endif %} Thanks for your contribution - the http://example.com team. ''' email_when_rejected_subject = 'Your comment on http://example.com was not approved' email_when_rejected = '''\ Your recent comment made on the http://example.com website was not approved for the following reason(s): {{reason_rejected}} {% if rejected_extra_info %} {{rejected_extra_info}} {% endif %} The http://example.com team. ''' # The web-based rejection interface will allow you to select one or more of the # these reasons. rejection_reasons = ( 'The comment was unrelated to the content of that page.', 'The comment appears to be spam or commercial in nature.', 'The comment contains inappropriate language for this website.', 'Other reason: please see the additional notes below.', ) # Template for email sent to comment admin to approve to reject a comment. # You may modify it as required, but you must at least include # comment.approval_code and comment.rejection_code in the message. email_for_approval_subject = 'Approve or reject new comment' email_for_approval = '''\ A new comment was received from: * Name = {{poster.name}} * email = {{poster.email}} * opted in for mailings = {{poster.opted_in}} * number previously approved = {{poster.number_of_approved_comments}} * IP number = {{comment.IP_address}} Their comment was related to content in: * file: {{reference.file_name}} * around line number: {{reference.line_number}} * with comment root: {{reference.comment_root}} * and comment node: {{comment.node}} * appearing on this page: {{webpage}} Their comment was: {{comment.comment_HTML}} Original RST for their comment: {{comment.comment_RST}} Click this link to ACCEPT the comment: {{comment.approval_code}} To REJECT the comment, click here: {{comment.rejection_code}} ''' # Header image header_image = STATIC_URL # Admin link admin_link = ("/" if url_views_prefix != "" else "") + url_views_prefix + "/_admin" # Create a local_settings.py file that overrides settings in this file. # This is useful if you update ucommentapp from revision control and don't want # to loose your settings everytime. Be sure to check for diffs against # this file (conf/settings.py). this_dir = __file__[0:__file__.find('settings.py')] try: execfile(this_dir + sep + 'local_settings.py') except IOError: pass del this_dir, sep, getcwd, mkdtemp 

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.