@@ -14,74 +14,48 @@ This is a Django 3.2 application backed by PostgreSQL and running on Python 3.x.
1414
1515First, prepare your development environment by installing pip, virtualenv, and postgresql-server-dev-X.Y.
1616
17- ```
18- $ sudo apt install python-pip postgresql-server-dev-14
19-
20- $ pip install virtualenv
17+ ``` bash
18+ sudo apt install python-pip postgresql-server-dev-14
2119```
2220
2321Next, configure your local environment with virtualenv and install local dependencies.
2422
23+ ``` bash
24+ python3 -m venv env
25+ source env/bin/activate
26+ pip install -r dev_requirements.txt
2527```
26- $ virtualenv env
27- $ source env/bin/activate
28- $ pip install -r requirements.txt
29- ```
30-
31- Now prepare the application to run locally.
3228
33- Configure the app to match your local installation by creating a
34- ` local_settings.py ` with the following content in the ` pgcommitfest ` directory.
35- Change the values for the database connection adequately.
29+ Create a database for the application:
3630
37- ```
38- # Enable more debugging information
39- DEBUG = True
40- # Prevent logging to try to send emails to postgresql.org admins.
41- # Use the default Django logging settings instead.
42- LOGGING = None
43-
44- DATABASES = {
45- 'default': {
46- 'ENGINE': 'django.db.backends.postgresql_psycopg2',
47- 'NAME': 'pgcommitfest',
48- 'USER': 'postgres',
49- 'PASSWORD': 'postgres',
50- 'HOST': '0.0.0.0',
51- }
52- }
53-
54- # Disables the PostgreSQL.ORG authentication.
55- # Use the default built-in Django authentication module.
56- AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend']
31+ ``` bash
32+ createdb pgcommitfest
5733```
5834
59- Provided that you created a database matching the above settings, you can
60- now create the required tables. Note that a password must be provided.
35+ Create a local settings file (feel free to edit it):
6136
62- ```
63- $ python manage .py migrate
37+ ``` bash
38+ cp pgcommitfest/local_settings_example .py pgcommitfest/local_settings.py
6439```
6540
66- You'll need either a database dump of the actual server's data or else to create a superuser:
41+ Now you can now create the required tables. Note that a password might need to
42+ be provided.
6743
68- ```
69- $ python manage.py createsuperuser
44+ ``` bash
45+ ./ manage.py migrate
7046```
7147
72- Finally, you're ready to start the application :
48+ You'll need either a database dump of the actual server's data or else to create a superuser :
7349
74- ```
75- $ python manage.py runserver
50+ ``` bash
51+ ./ manage.py createsuperuser
7652```
7753
78- To authenticate you'll first have to remove the customized login template.
79- Remember not to commit this modification.
54+ Finally, you're ready to start the application:
8055
81- ```
82- $ find . -type f -name login.html
83- $ rm -f global_templates/admin/login.html
56+ ``` bash
57+ ./run_dev.py
8458```
8559
86- Then open http://localhost:8000 /admin to log in. Once redirected to the Django
60+ Then open http://localhost:8007 /admin to log in. Once redirected to the Django
8761admin interface, go back to the main interface. You're now logged in.
0 commit comments