Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Sun, 14 Apr 2019 20:01:12 UTC
Commit: 6296c7f044c749739d38571d97b19b11fd5d56cc
https://github.com/geany/www.geany.org/commit/6296c7f044c749739d38571d97b19…
Log Message:
-----------
Update information for local development
Modified Paths:
--------------
README.dev.md
README.md
Modified: README.dev.md
108 lines changed, 41 insertions(+), 67 deletions(-)
===================================================================
@@ -12,7 +12,7 @@ and uses Mezzanine (http://mezzanine.jupo.org/) for content management.
As Django is based on Python, first of all you need Python and a couple of
extra packages installed on your system.
-For now, the code is tested against Python2 only.
+The code requires Python 3.5 or higher.
Prepare your system
@@ -23,12 +23,12 @@ virtualenv. Into the virtualenv we will install Django, Mezzanine and a couple o
other helper packages.
To be able to use virtualenv, you first need to install it as well as some
-development libraries for the MySQL and Memcache client libraries.
+development libraries for Python, the MySQL and Memcache client libraries.
The most easy way is to use the package manager of your distribution.
-On the Debian like systems the following command should install the necessary
+On Debian like systems the following command should install the necessary
packages:
- apt-get install python-virtualenv python-pip libmysqlclient-dev libmemcached-dev
+ apt-get install python3-venv python3-pip python3-dev build-essential libmysqlclient-dev libmemcached-dev
Get the code
@@ -45,17 +45,11 @@ Setting up a virtualenv
Change into the freshly cloned repository directory and execute the following commands
to create a new virtualenv and install required Python packages:
- export PIP_REQUIRE_VIRTUALENV=true
-
- virtualenv venv
- # activate virtual environment
- source venv/bin/activate
+ python3 -m venv venv
# upgrade some packages, just to be safe
- pip install --upgrade pip setuptools
- # very helpful tool to manage packages in addition to pip
- pip install git+git://github.com/eht16/yolk#egg=yolk
+ venv/bin/pip install --upgrade pip setuptools
# install our requirements
- pip install -r requirements.txt
+ venv/bin/pip install -r requirements.txt
This will setup a new virtualenv, upgrade the Python package manager
pip and install required packages for the website.
@@ -79,24 +73,19 @@ the settings to your needs:
DEBUG = True
DATABASES = {
- "default": {
- "ENGINE": "django.db.backends.mysql",
- "NAME": "dbname",
- "USER": "dbuser",
- "PASSWORD": "supersecret",
- "HOST": "127.0.0.1",
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(BASE_DIR, 'geany_dev_www.db'),
},
'nightlybuilds': {
- 'ENGINE': 'django.db.backends.mysql',
- 'NAME': 'dbname2',
- "USER": "dbuser",
- "PASSWORD": "supersecret",
- "HOST": "127.0.0.1",
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(BASE_DIR, 'geany_dev_nightly.db'),
}
}
# some random characters, should be unique per site, e.g. use str(uuid.uuid4())
- SECRET_KEY = "12345"
+ SECRET_KEY = "change-me-to-something-random-and-unique"
+ NEVERCACHE_KEY = "change-me-to-something-random-and-unique"
CACHES = {
'default': {
@@ -109,6 +98,11 @@ the settings to your needs:
CSRF_COOKIE_SECURE = False
SESSION_COOKIE_SECURE = False
SSL_FORCE_URL_PREFIXES = ()
+ INTERNAL_IPS = ("127.0.0.1",)
+ ALLOWED_HOSTS = ('127.0.0.1', 'localhost')
+
+ STATIC_DOCS_GEANY_SOURCE_DIR = '/path/to/geany/source/or/just/empty'
+ IRC_USER_LIST_FILE = '/path/to/irc/data/or/just/empty'
### Database settings
@@ -118,46 +112,35 @@ For local development you can also use Sqlite which is simpler
to setup but harder to work with when you need to manipulate the
data directly.
Your choice.
-Whatever database you use, ask Enrico to get a dump of a demo database
-to get something to work with. This dump can be easily imported into
+A dump of a demo database to get something to work with is available in
+`database.json`.
+This dump can be easily imported into
a configured database with the following command:
- python manage.py reset_db
- python manage.py migrate --no-initial-data
- echo 'TRUNCATE auth_permission; \
- TRUNCATE django_content_type; \
- TRUNCATE django_site;' | python manage.py dbshell
- python manage.py createsuperuser
- python manage.py loaddata database.json
-
-
-Start the development server
-----------------------------
+ venv/bin/python manage.py reset_db --noinput
+ venv/bin/python manage.py migrate --run-syncdb --noinput
+ echo 'DELETE FROM auth_permission;
+ DELETE FROM django_content_type;
+ DELETE FROM django_site;' | venv/bin/python manage.py dbshell
+ venv/bin/python manage.py loaddata database.json
-After you setup everything as described above, you are almost ready
-to start the development server to actually do something.
+The database dump contains a default admin user:
-Before, just one further step is required: activate your virtual environment.
-Execute the following command in the directory *www.geany.org*:
+ username: admin
+ password: change-me
- source venv/bin/activate
-This will activate the previously created virtualenv and mangles
-your Python environment so that the interpreter and related packages
-in the *venv* sub directory are used instead of the gloablly installed
-ones.
-On some shells, you will see a `(venv)` prefix in the prompt indicating
-a virtualenv is activated.
-If you later want to clean up your shell and leave that virtualenv, just
-type `deactivate` in your shell.
+Start the development server
+----------------------------
-Now, finally, it's time to start your development server:
+After you set up everything as described above, you are ready
+to start the development server to actually do something:
- python manage.py runserver
+ venv/bin/python manage.py runserver
This will start a simple HTTP server on *localhost* port 8000.
You can open the resulting site in your browser by pointing it
-to http://localhost:8000 .
+to http://localhost:8000.
Basically now you are done and you can start improving the website.
A little detail you might notice: once you change any .py file
@@ -210,20 +193,11 @@ Call this command after updates of the Pygments package and
then commit the updated CSS file `pastebin/static/css/pygments.css`.
-Special hostnames / DNS
------------------------
-
-Since this website project not only contains www.geany.org but also
-some related subsites (pastebin.geany.org, nightly.geany.org) there is
-a special DNS record on the geany.org zone: ***.local.geany.org**.
-
-This record and all subdomains will resolve to *127.0.0.1* (aka *localhost*).
+### manage.py generate_i18n_statistics
-In your browser you can use http://pastebin.local.geany.org:8000/ and
-http://nightly.local.geany.org:8000/ to use these subsites with your
-local development server.
-All other domains not recognized as a known subsite will fallback to
-the main website.
+Generate translation statistics by extracting them from the
+PO files of a Geany source. These statistics are shown on the
+website on /contribute/translation/statistics/.
Useful shell aliases
Modified: README.md
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -3,7 +3,7 @@ www.geany.org
About
-----
-This is new website code for www.geany.org.
+This is the new website code for www.geany.org.
It's based on Django and uses Mezzanine (http://mezzanine.jupo.org/, the coolest Django CMS)
for content management.
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Sun, 31 Mar 2019 14:09:21 UTC
Commit: a68aac442a4a17ba24adc394577bdcd9097eb012
https://github.com/geany/www.geany.org/commit/a68aac442a4a17ba24adc394577bd…
Log Message:
-----------
Update nightlybuilds app
Modified Paths:
--------------
nightlybuilds/database_routers.py
nightlybuilds/models.py
nightlybuilds/templatetags/nightlybuilds_tags.py
nightlybuilds/views.py
Modified: nightlybuilds/database_routers.py
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -48,5 +48,5 @@ def allow_relation(self, obj1, obj2, **hints):
return None
#----------------------------------------------------------------------
- def allow_migrate(self, db, model):
- return model._meta.app_label != 'nightlybuilds'
+ def allow_migrate(self, db, app_label, model_name=None, **hints):
+ return app_label != 'nightlybuilds'
Modified: nightlybuilds/models.py
13 lines changed, 9 insertions(+), 4 deletions(-)
===================================================================
@@ -3,12 +3,12 @@
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
-#
+#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -19,12 +19,17 @@
class NightlyBuildTarget(models.Model):
nightly_build_target_id = models.PositiveIntegerField(primary_key=True)
+ active = models.BooleanField()
project = models.CharField(max_length=50)
identifier = models.CharField(max_length=50)
name = models.CharField(max_length=50)
arch = models.CharField(max_length=50)
folder = models.CharField(max_length=50)
- last_nightly_build = models.ForeignKey('NightlyBuild', null=True, blank=True)
+ last_nightly_build = models.ForeignKey(
+ 'NightlyBuild',
+ null=True,
+ blank=True,
+ on_delete=models.PROTECT)
########################################################################
class Meta:
@@ -40,7 +45,7 @@ def __unicode__(self):
class NightlyBuild(models.Model):
nightly_build_id = models.PositiveIntegerField(primary_key=True)
- nightly_build_target = models.ForeignKey('NightlyBuildTarget')
+ nightly_build_target = models.ForeignKey('NightlyBuildTarget', on_delete=models.PROTECT)
status = models.BooleanField()
revision = models.CharField(max_length=255)
compiler_version = models.CharField(max_length=50)
Modified: nightlybuilds/templatetags/nightlybuilds_tags.py
16 lines changed, 11 insertions(+), 5 deletions(-)
===================================================================
@@ -3,17 +3,18 @@
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
-#
+#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django import template
from django.conf import settings
+from django.utils.html import format_html
import os
@@ -37,8 +38,11 @@ def get_build_log(nightly_build, log_type):
pass
else:
if size > 0:
- path = u'%s/%s' % (nightly_build.nightly_build_target.folder, log)
- return u'<a href="%s">%s</stdout>' % (path, log_type)
+ return format_html(
+ u'<a href="/{}/{}">{}</stdout>',
+ nightly_build.nightly_build_target.folder,
+ log,
+ log_type)
return u''
@@ -47,6 +51,8 @@ def get_build_log(nightly_build, log_type):
def get_details(nightly_build):
header_txt = os.path.join(base_dir, nightly_build.nightly_build_target.folder, 'HEADER.txt')
if os.path.exists(header_txt):
- return u'<a href="/%s/">Details</a>' % (nightly_build.nightly_build_target.folder)
+ return format_html(
+ u'<a href="/{}/">Details</a>',
+ nightly_build.nightly_build_target.folder)
else:
return u''
Modified: nightlybuilds/views.py
5 lines changed, 3 insertions(+), 2 deletions(-)
===================================================================
@@ -3,12 +3,12 @@
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
-#
+#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -25,5 +25,6 @@ class NightlyBuildsView(ListView):
queryset = NightlyBuild.objects.\
prefetch_related('nightly_build_target').\
+ filter(nightly_build_target__active=1).\
filter(nightly_build_target__last_nightly_build_id=F('nightly_build_id')).\
order_by('nightly_build_target__project', 'nightly_build_target__identifier')
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).