Skip to content

Commit 55819bf

Browse files
committed
docs update, fix 404 errors [ci skip]
1 parent 67b6b86 commit 55819bf

File tree

7 files changed

+71
-25
lines changed

7 files changed

+71
-25
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/Troubleshooting.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,38 @@ You forgot to add bootstrap JavaScript file to your template, make sure you have
4242
and CSS files to your included in your template. Checkout our `configuration instructions <configuration_page_>`_
4343
to see various options to do it.
4444

45+
46+
Fix 404 (Not Found) errors
47+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48+
49+
.. error:: GET ``http://.../datepicker-widget.js`` net::ERR_ABORTED 404 (Not Found)
50+
51+
.. error:: GET ``http://.../datepicker-widget.css`` net::ERR_ABORTED 404 (Not Found)
52+
53+
In some production environment you need to collect static JS/CSS resources from all packages to a single
54+
location specified as STATIC_ROOT in ``settings.py`` file. Check your hosting provider manual to see how
55+
to do it correctly.
56+
57+
Otherwise if your hosting interface provides access to console, log in to your server console and run the
58+
following command and then reload the server from your hosting interface.
59+
60+
::
61+
62+
python3 manage.py collectstatic
63+
64+
.. error:: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path
65+
66+
If you encounter above error then you don't have ``STATIC_ROOT`` directory set. Check your hosting provider
67+
instruction manual to identify the directory it serves static files from, generally it's the ``static``
68+
directory in your prject root. If so add the following line at the bottom of your ``settings.py`` file.
69+
70+
.. code-block:: python
71+
72+
STATIC_ROOT = os.path.join(BASE_DIR, "static")
73+
74+
Now you can execute ``collectstatic`` command and reload the server from your hosting interface.
75+
76+
4577
No errors anywhere, but the calendar does not show up!
4678
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4779
You forgot to add ``{{ form.media }}`` to your template. Checkout our `configuration instructions <configuration_page_>`_

docs/Usage.rst

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ Usage
55
Usage in Generic View
66
^^^^^^^^^^^^^^^^^^^^^^
77

8-
.. code:: python
8+
.. code-block:: python
9+
:emphasize-lines: 2,11
910
1011
# File: views.py
1112
from bootstrap_datepicker_plus import DateTimePickerInput
@@ -24,7 +25,8 @@ Usage in Generic View
2425
Custom Form usage
2526
^^^^^^^^^^^^^^^^^
2627

27-
.. code:: python
28+
.. code-block:: python
29+
:emphasize-lines: 2,11
2830
2931
# File: forms.py
3032
from bootstrap_datepicker_plus import DatePickerInput
@@ -43,7 +45,8 @@ Custom Form usage
4345
Model Form usage
4446
^^^^^^^^^^^^^^^^
4547

46-
.. code:: python
48+
.. code-block:: python
49+
:emphasize-lines: 2,11-12
4750
4851
# File: forms.py
4952
from bootstrap_datepicker_plus import DatePickerInput
@@ -65,7 +68,8 @@ Types of DatePickers
6568

6669
The widget contains all types of date-picker you may ever need.
6770

68-
.. code:: python
71+
.. code-block:: python
72+
:emphasize-lines: 2,11-15
6973
7074
# File: forms.py
7175
from bootstrap_datepicker_plus import DatePickerInput, TimePickerInput, DateTimePickerInput, MonthPickerInput, YearPickerInput
@@ -90,7 +94,8 @@ Implement date-range-picker
9094

9195
DatePickers can be linked to select a date-range or time-range.
9296

93-
.. code:: python
97+
.. code-block:: python
98+
:emphasize-lines: 2,11-12
9499
95100
# File: forms.py
96101
from bootstrap_datepicker_plus import DatePickerInput, TimePickerInput
@@ -116,7 +121,8 @@ The DatePicker can be customized by passing options to it.
116121
The ``options`` will be passed to the JavaScript datepicker instance, and are documented and demonstrated in
117122
`Bootstrap Datepicker Options Reference <http://eonasdan.github.io/bootstrap-datetimepicker/Options/>`__.
118123

119-
.. code:: python
124+
.. code-block:: python
125+
:emphasize-lines: 14-17
120126
121127
# File: forms.py
122128
from bootstrap_datepicker_plus import DatePickerInput
@@ -153,7 +159,8 @@ Customize the Language
153159
The DatePicker language can be customized by passing a ``locale`` option to datepicker input.
154160
See `moment.js locales <https://github.com/moment/moment/tree/develop/locale>`__ for valid locales.
155161

156-
.. code:: python
162+
.. code-block:: python
163+
:emphasize-lines: 14
157164
158165
# File: forms.py
159166
from bootstrap_datepicker_plus import DatePickerInput

docs/Walkthrough.rst

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ Install following packages:
2525

2626
Add these packages to the list of INSTALLED_APPS as you did here on `Tutorial 02 <django_tutorial_activating_model_>`_.
2727

28-
.. code:: python
28+
.. code-block:: python
29+
:emphasize-lines: 10,11
2930
30-
# FIle: mysite/settings.py
31+
# file: mysite/settings.py
3132
INSTALLED_APPS = [
3233
'polls.apps.PollsConfig',
3334
'django.contrib.admin',
@@ -46,9 +47,10 @@ CreateView for Question model
4647

4748
Add a CreateView for Question model. The ``get_form`` method is used to specify widgets on the form fields.
4849

49-
.. code:: python
50+
.. code-block:: python
51+
:emphasize-lines: 7,12-18
5052
51-
# FIle: polls/views.py
53+
# file: polls/views.py
5254
from django.http import HttpResponseRedirect
5355
from django.shortcuts import get_object_or_404, render
5456
from django.urls import reverse
@@ -73,9 +75,9 @@ Add a CreateView for Question model. The ``get_form`` method is used to specify
7375
Create a template named question_form.html in your app to render the form. If you use a different name you have to
7476
set template_name property of CreateView class in your views.py file above.
7577

76-
.. code:: html
78+
.. code-block:: html
7779

78-
<!-- File: polls/templates/polls/question_form.html -->
80+
<!-- file: polls/templates/polls/question_form.html -->
7981
{% load bootstrap4 %}
8082
{% bootstrap_css %}
8183
{% bootstrap_javascript jquery='full' %}
@@ -88,9 +90,10 @@ set template_name property of CreateView class in your views.py file above.
8890

8991
Add a ``get_absolute_url`` method to your Question model.
9092

91-
.. code:: python
93+
.. code-block:: python
94+
:emphasize-lines: 19-20
9295
93-
# FIle: polls/models.py
96+
# file: polls/models.py
9497
import datetime
9598
9699
from django.db import models
@@ -114,9 +117,10 @@ Add a ``get_absolute_url`` method to your Question model.
114117
115118
Add an urlpattern for creating new poll question.
116119

117-
.. code:: python
120+
.. code-block:: python
121+
:emphasize-lines: 9
118122
119-
# FIle: polls/urls.py
123+
# file: polls/urls.py
120124
from django.urls import path
121125
122126
from . import views
@@ -134,8 +138,10 @@ Add an urlpattern for creating new poll question.
134138
Now run the developement server and visit http://localhost:8000/polls/create, if everything works fine
135139
you can wrap up your template in proper HTML.
136140

137-
.. code:: html
141+
.. code-block:: html
142+
:emphasize-lines: 8-11,17
138143

144+
<!-- file: polls/templates/polls/question_form.html -->
139145
<!DOCTYPE html>
140146
<html lang="en">
141147
<head>
@@ -168,9 +174,9 @@ UpdateView for Question model
168174

169175
We can now add a page to update a poll question. First we add an UpdateView to our views.
170176

171-
.. code:: python
177+
.. code-block:: python
172178
173-
# FIle: add these to polls/views.py
179+
# file: add these to polls/views.py
174180
class UpdateView(generic.edit.UpdateView):
175181
model = Question
176182
fields = ['question_text', 'pub_date']
@@ -181,9 +187,10 @@ We can now add a page to update a poll question. First we add an UpdateView to o
181187
182188
Then add a urlpattern to access the question update page.
183189

184-
.. code:: python
190+
.. code-block:: python
191+
:emphasize-lines: 11
185192
186-
# FIle: polls/urls.py
193+
# file: polls/urls.py
187194
from django.urls import path
188195
189196
from . import views

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
"test": "python runtests.py",
1414
"coverage": "coverage run --source=bootstrap_datepicker_plus runtests.py && coverage report",
1515
"travis-test": "coverage run --source=bootstrap_datepicker_plus runtests.py",
16-
"build": "python setup.py sdist bdist_wheel",
1716
"docs": "start docs/_build/index.html",
18-
"build-docs": "sphinx-build docs docs\\_build",
19-
"pydoc.io": "sphinx-build docs\\pydoc.io docs\\_build",
17+
"build": "python setup.py sdist bdist_wheel",
18+
"build:docs": "sphinx-build docs docs\\_build",
19+
"build:pydoc": "sphinx-build docs\\pydoc.io docs\\_build",
2020
"upload": "twine upload dist/*",
2121
"test-upload": "twine upload --repository testpypi dist/*"
2222
},

0 commit comments

Comments
 (0)